Customized AutoNav
Permalink
Greetings all. It appears AutoNav has been quite the conversation topic lately, and here is another question from yours truly to keep it going.
I'm trying to include a customized AutoNav in the navigation menu of a customized CSS theme. I want the AutoNav hard-coded into the template file since this will be a multi-user site and I don't want anyone to be able to touch the navigation menu.
The problem is getting AutoNav to show the second levels of the site map. This is obviously the main nav, so I need it to start at the top and include the second levels as new "ul's" - in which case the CSS will add fly-outs. I've spent a lot of time searching for AutoNav documentation/API's and even read through all of the AutoNav PHP files, line by line, but with no luck. The code I have so far will get me the top level only (fully functional) but fails to get any of the sub-pages. If I do it the "right way" and add an AutoNav via block in the editor, it shows correctly. I built the following code based on this method using the data written into the database.
Any thoughts? Thanks for any ideas.
I'm trying to include a customized AutoNav in the navigation menu of a customized CSS theme. I want the AutoNav hard-coded into the template file since this will be a multi-user site and I don't want anyone to be able to touch the navigation menu.
The problem is getting AutoNav to show the second levels of the site map. This is obviously the main nav, so I need it to start at the top and include the second levels as new "ul's" - in which case the CSS will add fly-outs. I've spent a lot of time searching for AutoNav documentation/API's and even read through all of the AutoNav PHP files, line by line, but with no luck. The code I have so far will get me the top level only (fully functional) but fails to get any of the sub-pages. If I do it the "right way" and add an AutoNav via block in the editor, it shows correctly. I built the following code based on this method using the data written into the database.
<?php $bt_main = BlockType::getByHandle('autonav'); $bt_main->controller->displayPages = 'top'; $bt_main->controller->orderBy = 'display_asc'; $bt_main->controller->displaySubPages = 'all'; $subnav->controller->displaySubPageLevels = 'custom'; $subnav->controller->displaySubPageLevelsNum = 2; $bt_main->render('templates/header_menu'); ?>
Any thoughts? Thanks for any ideas.
WOW. ::facepalm::
That's what I get for copying and pasting. $subnav is the variable I used to grab AutoNav links in a side bar of a different template file. I don't know how I didn't see that.
A million thanks.
That's what I get for copying and pasting. $subnav is the variable I used to grab AutoNav links in a side bar of a different template file. I don't know how I didn't see that.
A million thanks.
haha... no problem. I did the same thing. I was like "This looks fine, what am I missing".
I might be missing part of it but I added a comment to the code. I not sure if it is a typo on your part but they should all be $bt_main->controller