Page 1 of 1

adding menu class for first item

Posted: Thu Jul 03, 2008 2:51 pm
by factor1
So I usually use the grass stains menu as a base for most horizontal menus. It works great. But I would like to add a class for the first item (as to remove the border-left from the far left of the menu).

here is the menu template I have working

Code: Select all

{* CSS classes used in this template:
.active - The active page in the horizontal menu (first level). 
.bullet_sectionheader - To style section header
hr.separator - To style the ruler for the separator *} 
{if $count > 0}
<ul>
{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->current == true or $node->parent == true}
<li class="active"><a href="{$node->url}" class="active">{$node->menutext}</a>
{else}
<li><a href="{$node->url}">:  {$node->menutext}  :</a>{/if}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-2}</li>
</ul>
{/if}
Anyone know where to start to add a if item first add the ?

thanks

Re: adding menu class for first item

Posted: Thu Jul 03, 2008 5:42 pm
by kermit
http://www.smarty.net/manual/en/languag ... erty.first
may lead you in the right direction.

Re: adding menu class for first item

Posted: Thu Jul 03, 2008 6:16 pm
by Dr.CSS
You can do this, but all the menu items will have a class you just need to use the one that shows for the first item...

{/if}
{if $node->current == true or $node->parent == true}
alias}[/color]">url}" class="active">{$node->menutext}
{else}
alias}[/color]">url}">:  {$node->menutext}  :{/if}
{/foreach}
{repeat string="" times=$node->depth-2}

{/if}

Re: adding menu class for first item

Posted: Mon Jul 07, 2008 8:29 pm
by factor1
thanks guys. I will play with these.