Page 1 of 1

How can I disable 'haschildren' in the Menu Module?

Posted: Tue Oct 10, 2006 10:03 am
by stopsatgreen
Perhaps that's not the best descriptive title... In the Menu Module I have a template set up for showing only levels 1 & 2, although I have a level 3 in the site as well.

I want my template to not register the level 3 pages, but the way it is setup, it returns 'haschildren=true' for the level 2 pages - which I don't want, as it then adds the 'menuparent' class to the list item.

I hope this makes sense; here is the code:

Code: Select all

{if $count > 0}
<ul>
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="<ul>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}
{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
<li class="menuactive menuparent"><a class="menuactive menuparent"
{elseif $node->current == true}
<li class="menuactive"><a class="menuactive"
{elseif $node->haschildren == true}
<li class="menuparent"><a class="menuparent"
{else}
<li><a 
{/if}
href="{$node->url}" {if $node->accesskey != ''}accesskey="{$node->accesskey}" {/if}{if $node->tabindex != ''}tabindex="{$node->tabindex}" {/if}{if $node->titleattribute != ''}title="{$node->titleattribute}"{/if}{if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}</a>{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}

Re: How can I disable 'haschildren' in the Menu Module?

Posted: Tue Oct 10, 2006 10:06 am
by tsw
hmm

{if $node->parent == true or ($node->current == true and $node->haschildren == true) and $node->depth <a class="menuactive menuparent"

untested...

Re: How can I disable 'haschildren' in the Menu Module?

Posted: Tue Oct 10, 2006 10:45 am
by stopsatgreen
That seems to have done the trick! Many thanks!

;D