Hardcoding autonav block not displaying
Permalink
I'm having some trouble hardcoding the autonav block into a page type. I've copied the example fromhttp://www.concrete5.org/documentation/how-tos/developers/hardcode-... and when I use var_dump() to check that the object was set along with the properties, it comes back with data which all looks normal. The problem is that the navigation doesn't display at all. I'm not sure of how to fix this or where to look next and googling hasn't gotten any answers yet.
If anyone has any ideas, I'd be grateful.
If anyone has any ideas, I'd be grateful.
$navBT = BlockType::getByHandle('autonav'); $navBT->controller->displayPages = 'second_level'; $navBT->controller->orderBy = 'display_asc'; $navBT->controller->displaySubPages = 'all'; $navBT->controller->displaySubPageLevels = 'all'; $navBT->controller->render('view');
Is there a live URL we could have a look at?
It's on a dev server which is locked down. But I can offer more context in the form of the surrounding HTML.
It's possible I'm not seeing something obvious and just need a second pair of eyes.
<div id="body"> <div id="middle"> <div id="contentwrapper"> <div id="content"> <?php print "test"; $navBT = BlockType::getByHandle('autonav'); $navBT->controller->displayPages = "second_level"; $navBT->controller->orderby = "display_asc"; $navBT->controller->displaySubPages = "all"; $navBT->controller->displaySubPageLevels = "all"; $navBT->render("view"); print "<h1>".$page->vObj->cvName."</h1>"; $a = new Area('Main'); $a->display($c);
Viewing 15 lines of 21 lines. View entire code block.
It's possible I'm not seeing something obvious and just need a second pair of eyes.
This is a working example I use:
If that still doesn't work, I would suggest:
• Do those pages have read permissions?
• Are those pages 'exclude_from_nav'?
• Are there any pages at the second level?
<?php $autonav = BlockType :: getByHandle ( 'autonav' ); $autonav -> controller -> orderBy = 'display_asc'; $autonav -> controller -> displayPages = 'second_level'; $autonav -> controller -> displaySubPages = 'all'; $autonav -> controller -> displaySubPageLevels = 'custom'; $autonav -> controller -> displaySubPageLevelsNum = '2'; $autonav -> render ( 'view' ); ?>
If that still doesn't work, I would suggest:
• Do those pages have read permissions?
• Are those pages 'exclude_from_nav'?
• Are there any pages at the second level?