displaying childrenof in submenu

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
KW2912
Forum Members
Forum Members
Posts: 14
Joined: Thu May 23, 2013 1:52 pm

displaying childrenof in submenu

Post by KW2912 »

Sorry if this has already been answered elsewhere but I've looked through every post regarding "menu" and can't seem to solve my problem.

It's a simple task really. Trying to create a sub menu on my side nav reading from the main page. HTML for page template is:

Code: Select all

<!-- start menu -->
<div id="menu">
  <div class="inner-content">{menu}</div>
</div>
<!-- end menu -->

<!-- start content -->
<div id="content">

<div class="pflo-left">
<div id="pflo-menu">{menu childrenof='portfolio'}</div>
</div>

<div class="pflo-right">{content}</div>

</div>
<!-- end content -->
I'm using a custom menu template (basically just a copy of simple_navigation.tpl) and called it "main". I've selected it as my default so I can just the {menu} tag to call it. The menu template code is:

Code: Select all

{* CSS classes used in this template:
.activeparent - The top level parent when a child is the active/current page
li.active0n h3 - n is the depth/level of the node. To style the active page for each level separately. The active page is not clickable.
.clearfix - Used for the unclickable h3 to use the entire width of the li, just like the anchors. See the Tools stylesheet in the default CMSMS installation.
li.sectionheader h3 - To style section header
li.separator - To style the ruler for the separator *} 

{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}
<ul>
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="<ul>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}

{if $node->parent == true or $node->current == true}
  {assign var='classes' value='menuactive'}
  {if $node->parent == true}
    {assign var='classes' value='menuactive menuparent'}
  {/if}
  {if $node->children_exist == true and $node->depth < $number_of_levels}
    {assign var='classes' value=$classes|cat:' parent'}
  {/if}
  <li class="{$classes}"><a class="{$classes}" href="{$node->url}"><span>{$node->menutext}</span></a> |

{elseif $node->children_exist == true and $node->depth < $number_of_levels and $node->type != 'sectionheader' and $node->type != 'separator'}
<li class="parent"><a class="parent" href="{$node->url}"><span>{$node->menutext}</span></a>

{elseif $node->current == true}
<li class="currentpage"><h3><span>{$node->menutext}</span></h3>

{elseif $node->type == 'sectionheader'}
<li class="sectionheader"><span>{$node->menutext}</span>

{elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;"> <hr />

{else}
<li><a href="{$node->url}"><span>{$node->menutext}</span></a>

{/if}

{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}
My problem is that the {menu} shows just fine on the top of my page but the sub menu doesn't show anything (it is main category item 3 and has 12 sub pages 3.1, 3.2 etc. I've tried:

{menu childrenof='portfolio'} (main category name)
{menu childrenof=$page_alias}
{menu start_level='2' collapse='1'}
{menu template='simple_navigation.tpl' number_of_levels='1'} with {menu template='simple_navigation.tpl' start_level='2' collapse='1'}

Both menu's are in different div classes for styling purposes but I'm guessing that shouldn't affect it?

Probably something really simple - can anybody spot anything glaringly obvious that I've missed?

Thanks for any help you can provide.
KW2912
Forum Members
Forum Members
Posts: 14
Joined: Thu May 23, 2013 1:52 pm

SOLVED Re: displaying childrenof in submenu

Post by KW2912 »

Yep I guessed - idiot on keyboard. It helps if you actually select the "show in menu" item for the sub pages. Doh!!!!
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: displaying childrenof in submenu

Post by velden »

I'd suggest to make a pre-installed menu template the default. Just to test it's not a mistake in your customizations.

{menu number_of_levels="1" start_level="2"} Should work.
User avatar
fearmydesign
Power Poster
Power Poster
Posts: 363
Joined: Sun Feb 28, 2010 10:54 pm

Re: displaying childrenof in submenu

Post by fearmydesign »

This thread was very helpful :) Thank you
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: displaying childrenof in submenu

Post by Rolf »

Please don't forget to add [solved] to the title of the first post. Thanks.
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Post Reply

Return to “CMSMS Core”