Page 1 of 1

menu manager - exclude childs from specific items

Posted: Thu Oct 09, 2014 11:07 am
by sumpson
Because I used some pages only for data which are later retrieved by {cgsimple::get_page_content} they should not be showing in the menu.

I came up with the following solution:

Code: Select all

{menu template="catchildsmenu" childrenof="productgroepen" number_of_levels="1" assign="catchilds"}

{menu template="menu" excludeprefix={$catchilds|replace:',last':''} number_of_levels="2"}
for the template catchildsmenu I have:

Code: Select all

{assign var='number_of_levels' value=10000}
{if isset($menuparams.number_of_levels)}
  {assign var='number_of_levels' value=$menuparams.number_of_levels}
{/if}

{if $count > 0}
{foreach from=$nodelist item=node}{$node->alias},{/foreach}last
{/if}
I'm using this in combination with multilanguage from http://www.i-do-this.com/blog/Another-m ... MS-Page/57

this is my full code:

Code: Select all

{if $page_lang == 'nl'}{menu template="catchildsmenu" childrenof="productgroepen" number_of_levels="1" assign="catchilds"}{/if}
		{if $page_lang == 'de'}{menu template="catchildsmenu" childrenof="produktgruppen" number_of_levels="1" assign="catchilds"}{/if}
		{if $page_lang == 'en'}{menu template="catchildsmenu" childrenof="product-groups" number_of_levels="1" assign="catchilds"}{/if}
		{if $page_lang == 'fr'}{menu template="catchildsmenu" childrenof="produit" number_of_levels="1" assign="catchilds"}{/if}

		<nav>{menu template="menu" excludeprefix={$catchilds|replace:',last':''} number_of_levels="2" start_level="2"}</nav>
I've been looking quiet a while for a solution to the problem, hope this helps someone.