Auto-Nav not nesting when used in theme
Permalink
Hi everyone and thanks in advance.
I'm creating a theme in which I want to fix the properties of some navigation. When I hard-code an auto-nav block into one of my templates, nesting doesn't work. I have the following code in my template...
...which outputs all the correct links, but they all show as <li>s within the same <ul> rather than inside nested <ul>s which reflect the actual page structure.
So, I'm getting something out which like this...
...but I would like see something more like this...
I've tried adding an auto-nav block with the same settings into the page using edit mode, and it outputs with the correct nesting, so my underlying sitemap is definitely correct.
Maybe I'm missing something in the auto-nav configuration...
Any suggestions gratefully received! Many thanks.
I'm creating a theme in which I want to fix the properties of some navigation. When I hard-code an auto-nav block into one of my templates, nesting doesn't work. I have the following code in my template...
<?php $bt = BlockType::getByHandle('autonav'); $bt->controller->orderBy = 'chrono_desc'; $bt->controller->displayPages = 'third_level'; $bt->controller->displaySubPages = 'all'; $bt->controller->displaySubPageLevels = 'all'; $bt->render('templates/header_menu'); ?>
...which outputs all the correct links, but they all show as <li>s within the same <ul> rather than inside nested <ul>s which reflect the actual page structure.
So, I'm getting something out which like this...
<ul> <li><a href="">Level 3</a></li> <li><a href="">Level 4</a></li> <li><a href="">Level 4</a></li> <li><a href="">Level 3</a></li> <li><a href="">Level 4</a></li> <li><a href="">Level 4</a></li> </ul>
...but I would like see something more like this...
<ul> <li><a href="">Level 3</a> <ul> <li><a href="">Level 4</a></li> <li><a href="">Level 4</a></li> </ul> </li> <li><a href="">Level 3</a> <ul> <li><a href="">Level 4</a></li> <li><a href="">Level 4</a></li> </ul> </li> </ul>
I've tried adding an auto-nav block with the same settings into the page using edit mode, and it outputs with the correct nesting, so my underlying sitemap is definitely correct.
Maybe I'm missing something in the auto-nav configuration...
Any suggestions gratefully received! Many thanks.
Render the normal view
and see if it outputs what you were expecting. If so you can use the view.php as the basis for making a new custom template for your header navigation needs.