cssmenu AND IUser module
Posted: Sun Oct 26, 2008 2:42 am
I just wanted to share a conflict I discovered. If you install the IUser addon, you can cause certain menu items to not appear if the user doesn't have rights. BUT, this breaks the functionality of cssmenu that comes with cmsms.
The node->previousdepth is incorrect if certain pages are hidden from the user. And my decrementing based on that, it will end the menu early. A local variable used instead of previous depth fixes the code for all cases.
The node->previousdepth is incorrect if certain pages are hidden from the user. And my decrementing based on that, it will end the menu early. A local variable used instead of previous depth fixes the code for all cases.
Code: Select all
{* CSS classes used in this template:
#menuwrapper - The id for the <div> that the menu is wrapped in. Sets the width, background etc. for the menu.
#primary-nav - The id for the <ul>
.menuparent - The class for each <li> that has children.
.menuactive - The class for each <li> that is active or is a parent (on any level) of a child that is active. *}
{if $count > 0}
<div id="menuwrapper">
<ul id="primary-nav">
{assign var="truedepth" value=1}
{foreach from=$nodelist item=node}
{if $node->depth > $truedepth }
{repeat string="<ul>" times=$node->depth-$truedepth}
{elseif $node->depth < $truedepth}
{repeat string="</li></ul>" times=$truedepth-$node->depth}
{elseif $node->index > 0}</li>
{/if}
{assign var="truedepth" value=$node->depth}
{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"
{elseif $node->type == 'sectionheader'}
<li class="sectionheader"><span> {$node->menutext} </span>
{elseif $node->type == 'separator'}
<li style="list-style-type: none;"> <hr class="separator" />
{else}
<li><a
{/if}
{if $node->type != 'sectionheader' and $node->type != 'separator'}
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}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>
{elseif $node->type == 'sectionheader'}
><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>
{/if}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}
</li>
<div class="clearb"></div>
</div>
{/if}