adding menu class for first item

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
factor1
Forum Members
Forum Members
Posts: 128
Joined: Thu Apr 13, 2006 11:24 pm

adding menu class for first item

Post 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
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: adding menu class for first item

Post by kermit »

http://www.smarty.net/manual/en/languag ... erty.first
may lead you in the right direction.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: adding menu class for first item

Post 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}
User avatar
factor1
Forum Members
Forum Members
Posts: 128
Joined: Thu Apr 13, 2006 11:24 pm

Re: adding menu class for first item

Post by factor1 »

thanks guys. I will play with these.
Post Reply

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