menu manager - exclude childs from specific items

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
sumpson
Forum Members
Forum Members
Posts: 111
Joined: Thu May 08, 2008 6:35 pm

menu manager - exclude childs from specific items

Post 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.
Post Reply

Return to “Tips and Tricks”