Dynamic Navigation in ExpressionEngine 2
I'm new to expressionEngine 2 and I'm facing a web site that needs a massive navigation and sub navigation. After having a quick look, it seems that I have to put the nav in template and it has to be hard coded.
The only way I've found was to use the module called NavEE but still, for every page created, we need to create a navigation item. Is there a way to generate the nav directly from the template based on the nodes creat开发者_JS百科ed.
Thanks.
There are a few ways to do this, but it mostly depends on how you're setting up your channels. For example, if you have a channel called 'pages' you could start your dynamic navigation this way:
<ul>
{exp:channel:entries channel="pages" dynamic="off"}
<li><a href="{url_title}">{title}</a></li>
{/exp:channel:entries}
</ul>
That should give you a good base dynamic navigation. If you want to go further, you could use a related entries custom field and relate other entries (as subpages) back to the entry.
If you're really building out a complex navigation and structure, take a look at purchasing the Structure module - http://buildwithstructure.com/. You'll need to build your site with Structure in mind if you're going that way though.
精彩评论