Hi there. I’m quite new to both EE and PHP. I’m about to program a three-level-menu site, where I hardcoded the first level in the index files of the different template groups (e.g. »Services« / »About us« and so on) and I didn’t get any help in the »how-to«-forum.
Both the second and the third level run with the cat_expand-plugin, category groups corresponding to the first level menu items with their (sub-)categories assigned to weblog entries.
I’d be really glad it there was any help, otherwise I’ll have to alter my template group structure to a unnecessary complex one. Or how else can I code a three-level navigation, where all three levels are highlighted, when I am on a subpage (top level on top of page horizontally, second and third level as hierarchical sidebar-menu)? I hardcoded the first level in different template groups and for the moment the second and third are categories and subcategories in category groups corresponding to the template groups.
To highlight the first level is no problem because it’s hardcoded, but how should I do this on the other two levels? The plugin serves a certain »active-style«-command, but that only wraps a div around the a-tag and can’t include a CSS-class to the a-tag and also it does this only for the present (sub-)category, but not its parent category. Should I rather change something in the plugin PHP or can I do this with some conditionals in the following template code? Or is the cat_expand_plugin the wrong way for this use in the first place? Creating new templates for every navigational state in all sublevels seems a bit unnecessary to me in a CMS …
Am I totally wrong with this concept? Thanks for any ideas …
<div id="subnav">
{exp:cat_expand:wrapper}
{exp:weblog:categories root_node="8"}
{exp:cat_expand:expander category="{category_id}"}
<a href="http://{path=template_group}">{category_name}</a>
{/exp:cat_expand:expander}
{/exp:weblog:categories}
{/exp:cat_expand:wrapper}
</div>
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.