Wednesday 03 June 2009 3:07:26 am
Hi; I'd like to dive different css classes to each menu item automatically. I want to construct class names, eg. "lido1", "lido2", etc. But when I put:
{foreach $top_menu_items as $key => $item}
{if $key}
{set $item_class = $item_class|append("lido",$key)}
{/if}
... it produces the output "lido 1", "lido 2" etc, which is invalid. Now I'm forced to write:
{if $key|eq(1)}
{set $item_class = $item_class|append("lido1")}
{/if}
{if $key|eq(2)}
{set $item_class = $item_class|append("lido2")}
{/if}
{if $key|eq(3)}
{set $item_class = $item_class|append("lido3")}
{/if}
{if $key|eq(4)}
{set $item_class = $item_class|append("lido4")}
{/if}
{if $key|eq(5)}
{set $item_class = $item_class|append("lido5")}
{/if}
... Can it be done in a simplified way?
Shiki soku ze ku...
|