Here an example of an altered Menu template which does that. You need to call it with 'number_of_levels=2'
Code: Select all
{* CSS classes used in this template:
.currentpage - The active/current page
.bullet_sectionheader - To style section header
hr.separator - To style the ruler for the separator *}
{if $count > 0}
<ul id="mainmenu" class="clearfix">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{assign var="enteredsub" value=true}{assign var="subcount" value=0}
{elseif $node->depth < $node->prevdepth}
{assign var="enteredsub" value=false}({$subcount})</a></li>
{elseif $node->index > 0 && !$enteredsub}</a></li>
{/if}
{if $enteredsub}{assign var="subcount" value=$subcount+1}
{else}
{if $node->current == true}
<li{if $node->extra1 ne ""} class="{$node->extra1}"{/if}><a href="{$node->url}" class="currentpage"{if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}
{elseif $node->parent == true && $node->depth == 1 and $node->type != 'sectionheader' and $node->type != 'separator'}
<li class="activeparent{if $node->extra1 ne ""} {$node->extra1}{/if}"> <a href="{$node->url}" class="activeparent"{if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}
{elseif $node->type == 'sectionheader'}
<li class="sectionheader{if $node->extra1 ne ""} {$node->extra1}{/if}"><a>{$node->menutext}
{elseif $node->type == 'separator'}
<li style="list-style-type: none;"> <hr class="separator" />
{else}
<li{if $node->extra1 ne ""} class="{$node->extra1}"{/if}><a href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}
{/if}
{/if}
{/foreach}
{if $enteredsub}({$subcount}){/if}</a></li>
</ul>
{/if}
It uses two extra variables:
enteredsub to determine if it is 'in the submenu' and subcount to count the submenu items.
This should give you an idea how to implement this in your situation. I'm not sure if this is the most efficient way.