Share » Forums » Developer » change submenu color

change submenu color

change submenu color

Tuesday 26 October 2010 3:01:47 am - 1 reply

Author Message

Lo' F.

Tuesday 26 October 2010 4:43:51 am

Hi viraj, you may set a submenu class through an if condition according to its parent node id.

You should already have your list of fetched items..

{def $submenu_items = fetch( 'content', 'list', hash( 'parent_node_id', $root_node.node_id, ...}

then inside the foreach loop...

{foreach $submenu_items as $key => $item}..

..declare and set the item class according to its parent node id..

..
{def $item_class=""}
{if $item.parent_node_id|eq([here goes the actual parent node id])}
    {set $item_class = "[here goes your style-class-name]")}
{/if}
{if $item.parent_node_id|eq([here goes the other parent node id])}
    {set $item_class = "[here goes the other style-class-name]")}
{/if}
{if $item.parent_node_id|eq([again like above])}
    [..and so on depending on the main menu items you have]
{/if}

and then include the class in the item tag..

<a .. class={$item_class}>{$item.name}</a>

and of course set the classes in your css file

.class-name1 {color: #red;}
.class-name2 {color: #green;}

loredanaebook.it

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu