We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

3-Level-Category Expanding Menu Problem

Development and Programming

ombotron's avatar
ombotron
8 posts
17 years ago
ombotron's avatar ombotron

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.

3-level-expanding-menu

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>
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.