[Solved] How do I change the color of some menu items and not others?

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
User avatar
SusanN
Forum Members
Forum Members
Posts: 192
Joined: Wed Jun 13, 2007 5:57 pm

[Solved] How do I change the color of some menu items and not others?

Post 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!
Last edited by SusanN on Thu Mar 19, 2009 12:02 am, edited 1 time in total.
User avatar
SusanN
Forum Members
Forum Members
Posts: 192
Joined: Wed Jun 13, 2007 5:57 pm

Re: How do I change the color of some menu items and not others?

Post 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}
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: How do I change the color of some menu items and not others?

Post 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
User avatar
SusanN
Forum Members
Forum Members
Posts: 192
Joined: Wed Jun 13, 2007 5:57 pm

Re: How do I change the color of some menu items and not others?

Post by SusanN »

Thanks!
Post Reply

Return to “Layout and Design (CSS & HTML)”