[SOLVED] contents show with haschildren

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
neto
Forum Members
Forum Members
Posts: 17
Joined: Thu Mar 19, 2009 6:10 pm

[SOLVED] contents show with haschildren

Post by neto »

Hi,
I have a box qith my menu (level 2) it works fine, but i dont want it to show when there is no level 2 menu for de node.

I searched in the forum but all I find appears to more complex than this issue.

here is the code i used - but its not working:

Code: Select all

{if $node->haschildren == true}
	<h1>Tópicos</h1>
	<div class="left-box">
		{menu start_level="2"}
	</div>
{/if}
I saw in the forum the term :"$currentNode" but i could not find the doc for this.

I dont know if I can use something like $this.node - Im new with this

I would apreciate some directions, thank you.
Last edited by neto on Mon Jan 09, 2012 11:48 am, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: contents show with haschildren

Post by Dr.CSS »

The $node calls are only understood in menu manager when parsing a menu template...

{capture assign='menu2'}{menu start_level="2"}{/capture}
{if !empty($menu2)} means if it's not empty show this below
<h1>Tópicos</h1>
<div class="left-box">
{$menu2}
</div>
{else}
leaving this empty/blank will show nothing
{/if}
neto
Forum Members
Forum Members
Posts: 17
Joined: Thu Mar 19, 2009 6:10 pm

Re: contents show with haschildren

Post by neto »

Thank you Dr.Css,

I can understand your code and I like it. Thank you for the hints.

But its not working for me. I still get my tópicos left-box with no content on it.

I must have missed something! Any suggestions?

site: http://filhosdaverdade.org.br/novo
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: contents show with haschildren

Post by Dr.CSS »

You put it in your template exactly like I have here?...

{capture assign='menu2'}{menu start_level="2"}{/capture}
{if !empty($menu2)}
<h1>Tópicos</h1>
<div class="left-box">
{$menu2}
</div>
{/if}

Slight change...
neto
Forum Members
Forum Members
Posts: 17
Joined: Thu Mar 19, 2009 6:10 pm

Re: contents show with haschildren

Post by neto »

Thank you DR.css

its is working fine I had ident the code like this:

Code: Select all

{capture assign='menu2'}
  {menu start_level="2"}
{/capture}
{if !empty($menu2)}
  <h1>Tópicos</h1>
  <div class="left-box">
  {$menu2}
  </div>
{/if}
when I put exactly as you wrote it work just fine!
Post Reply

Return to “CMSMS Core”