Embed sub-nav in theme

Permalink
I got the header nav automatically included on every page by making a scrapbook block as described here:http://www.concrete5.org/community/forums/customizing_c5/embedded-a...

I want to do the same thing with a sub nav that appears on every page, which shows all the pages that exist under the level one page that's currently selected. I can't figure out how to set up the sub nav so that this works. I suspect that it can't be done this way as a scrapbook block.

Any ideas?

bengenares
 
tek01 replied on at Permalink Best Answer Reply
It is possible. Look here to find the correct configuration for the Auto nav http://www.concrete5.org/index.php?cID=49182... .

This code example will help you too:
<?php 
   $bt_main = BlockType::getByHandle('autonav'); 
   $bt_main->controller->displayPages = 'custom'; // top, above, below, second_level, third_level, custom (Specify the displayPagesCID below)
   $bt_main->controller->displayPagesCID = '62'; // <-- Specify the CID of the page named: REPERTOIRE ( Gets the first level of pages under that section )
   $bt_main->controller->orderBy = 'display_asc';  // display_asc, display_desc, chrono_asc, chrono_desc, alpha_desc 
   $bt_main->controller->displaySubPages = 'relevant';  // none,  relevant, relevant_breadcrumb, all
   $bt_main->controller->displaySubPageLevels = 'custom'; //custom, none
   $bt_main->controller->displaySubPageLevelsNum = '0'; // Specify how deep level 
   $bt_main->render('templates/sub_nav'); // Specify your template or type "view" to use default
?>


Sorry i'm late can't help you further today.
jordanlev replied on at Permalink Reply
jordanlev
I am assuming you already tried making a second scrapbook block and putting the proper settings in that?

Unfortunately there is a kinda-sorta bug in the current version of Concrete5 that tricks the autonav block into thinking that "below this page" means below the page that the block was originally placed on (which in this case is the dashboard scrapbook page) as opposed to below the page currently being viewed. It will be fixed in the next release of C5, but in the meantime you can put the update in your current site (assuming you're using Concrete version 5.4.1.1) -- go to this page:
https://raw.github.com/concrete5/concrete5/master/web/concrete/blocks/autonav/controller.php

...and "Save As" (make sure it saves as "controller.php"). Then put that file up on your server here:
YOURSITE/concrete/blocks/autonav/

(it will be replacing the file that's already there).

-Jordan
tek01 replied on at Permalink Reply
Jordan is (as always) right, I was not aware of the bug.
bengenares replied on at Permalink Reply
bengenares
I like the idea of putting the Nav directly in the theme even better anyway.