Add class to last menu item

If you want to style your last navigation item with different class in MenuManager you can use a snippet like this.

{foreach from=$nodelist item=node name=menuitem}
<!--  your MenuManager code -->


<a href="{$node->url}"{if $smarty.foreach.menuitem.last} class="last-menu-item"{/if}>{$node->menutext}</a>
{/foreach}

With Smarty 3 syntax that is available in CMSMS since 1.11.x Version it is even easier.

{foreach $nodelist as $node}
<!--  your MenuManager code -->


<a href="{$node->url}"{if $node@last} class="last-menu-item"{/if}>{$node->menutext}</a>
{/foreach}

Comments