Page 1 of 1
[Solved] How do I change the color of some menu items and not others?
Posted: Wed Mar 18, 2009 5:42 pm
by SusanN
I'm sure there's a way to assign a class to some menu items while not doing so to others, but I'm not familiar enough with the menu manager code to make it work.
I need to make the first half of my menu one color and the 2nd half another color.
TIA!
Re: How do I change the color of some menu items and not others?
Posted: Wed Mar 18, 2009 10:59 pm
by SusanN
Okay, I think I'm supposed to add this to the menu template: id="{$node->alias}" Is that right? If so, where do I add it? I've tried several spots and it's just not working for me.
Code: Select all
{if $count > 0}
<div id="left-inner">
<ul id="leftnav">
{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"
{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>
</ul>
<div class="clearb"></div>
</div>
{/if}
Re: How do I change the color of some menu items and not others?
Posted: Wed Mar 18, 2009 11:32 pm
by Nullig
Here are the changes to the list section:
Code: Select all
{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
<li id="{$node->alias}" class="menuactive menuparent"><a class="menuactive menuparent"
{elseif $node->current == true}
<li id="{$node->alias}" class="menuactive"><a class="menuactive"
{elseif $node->haschildren == true}
<li id="{$node->alias}" 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 id="{$node->alias}"><a
{/if}
Just replace that section with the above code.
Nullig
Re: How do I change the color of some menu items and not others?
Posted: Thu Mar 19, 2009 12:02 am
by SusanN
Thanks!