Search the Community
Showing results for tags 'parents active'.
-
Hi I am trying to make a change to the blockcategories menu. As for now the currently active category link ( li > a ) gets "class=selected". This is the original code from category-tree-branch.tpl: <a href="{$node.link|escape:'html':'UTF-8'}"{if isset($currentCategoryId) && $node.id == $currentCategoryId} class="selected"{/if} title="{$node.desc|strip_tags|trim|escape:'html':'UTF-8'}"> {$node.name|escape:'html':'UTF-8'} </a> What I am trying to achieve is to have EVERY parent category of the current category also get a "class=selected" or similar. (I have a 4-level deep category tree) I already found a snippet of code in this forum and currently have changed the above code to this: <a href="{$node.link|escape:'html':'UTF-8'}"{if isset($currentCategoryId) && $node.id == $currentCategoryId} class="selected"{/if} {foreach from=$node.children item=child name=categoryTreeBranch}{if $child.id == $currentCategoryId}class="selected-parent"{/if}{/foreach} title="{$node.desc|strip_tags|trim|escape:'html':'UTF-8'}"> {$node.name|escape:'html':'UTF-8'} </a> (so I added the part with foreach...) This gives me a "class=selected-parent" on the DIRECT parent category, which is already quite nice and close to what I want to achieve. The only thing I would like to change, is that EACH and EVERY parent category above my current category is marked with "class=selected-parent", not only the direct parent. Can anyone point me in the right direction on how I should change this part of the code...? {foreach from=$node.children item=child name=categoryTreeBranch}{if $child.id == $currentCategoryId}class="selected-parent"{/if}{/foreach} Thanks very much.
- 1 reply
-
- blockcategories
- parents active
- (and 7 more)