Add an ID to the 5th Menu item?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
User avatar
beherenow_uk
Forum Members
Forum Members
Posts: 103
Joined: Fri Nov 28, 2008 11:26 am
Location: London, UK

Add an ID to the 5th Menu item?

Post by beherenow_uk »

Hi,

I have read the smarty manual, and appear to be able to add an ID to every 5th item using iteration, but how can i target just the 5th menu item? I can't get anything to work in the menu manager...

This code is the iteration...

Code: Select all

<li class="{$classes}" {if $smarty.foreach.foo.index % 5 == 0} id="lasttalk" {/if}><a class="{$classes}" href="{$node->url}"><span>{$node->menutext}</span></a>
Any ideas? Thanks.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Add an ID to the 5th Menu item?

Post by calguy1000 »

{if $smarty.foreach.foo.index % 5 == 0}

try

{if $smarty.foreach.foo.index == 4} {* yes 4 *}
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 “CMSMS Core”