changing colors for odd and even navigation elements

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
barry cooper
Forum Members
Forum Members
Posts: 63
Joined: Fri Jul 13, 2007 6:49 am

changing colors for odd and even navigation elements

Post by barry cooper »

Hi again,

I am trying to use smarty cycle:

{section name=name loop=$menu}
{$menu[name]}
{/section}

to change the alternate the background color in a vertical nav bar. All achieve something like http://tatteredfly.com/

I am using the following CSS:

div#menu_vert {
  margin:0;
  padding:0;
  color:#333399;
}

div#menu_vert li {
  list-style:none;
  margin-bottom:2px;
  padding:4px 4px 4px 10px;
}

div#menu_vert li.odd {
  background:#33CC99;
}

div#menu_vert li.even {
  background:#009933;
}

I am using the following tag to insert the nav bar info:

{menu template='simple_navigation.tpl' collapse='1'}

My question is what do I have to do to the smarty cycle code to make this work?  I am not sure which bits of the code to alter.

Many Thanks

Barry Cooper
KO
Power Poster
Power Poster
Posts: 562
Joined: Mon Nov 06, 2006 7:55 pm

Re: changing colors for odd and even navigation elements

Post by KO »

You might want to check that menu template simple_navigation.tpl and look for code

Code: Select all

{else}
<li><a href="{$node->url}"
change it

Code: Select all

{else}
<li class="{cycle values="even,odd"}"><a href="{$node->url}"
Maybe that is the place you are looking for...

Br, K
barry cooper
Forum Members
Forum Members
Posts: 63
Joined: Fri Jul 13, 2007 6:49 am

Re: changing colors for odd and even navigation elements

Post by barry cooper »

Is there a way of modifying the menu manager code and saving under  the same name.

Thanks

Baz C
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: changing colors for odd and even navigation elements

Post by RonnyK »

Barry,

I don't think that that works, as you are now working with the .tpl version. That one is the file-version. When you press the import-button on that menu, you can import it to the DB and give it a name. I think it is good to give it another name as well, as you'll know it's changed from the standard. After giving it a name, you have to change the calling in the template, changing to the new name, AND WITHOUT .tpl, as it is a DB-template.

Ronny
barry cooper
Forum Members
Forum Members
Posts: 63
Joined: Fri Jul 13, 2007 6:49 am

Re: changing colors for odd and even navigation elements (SOLVED)

Post by barry cooper »

This is the best Forum ever.

MANY MANY THANKS!!!

Regards

Barry Cooper
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: changing colors for odd and even navigation elements

Post by calguy1000 »

Please refrain from dual posting.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

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