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

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
stopsatgreen
Power Poster
Power Poster
Posts: 322
Joined: Sat Feb 04, 2006 1:24 am

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

Post 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}
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

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

Post by tsw »

hmm

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

untested...
stopsatgreen
Power Poster
Power Poster
Posts: 322
Joined: Sat Feb 04, 2006 1:24 am

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

Post by stopsatgreen »

That seems to have done the trick! Many thanks!

;D
Post Reply

Return to “CMSMS Core”