Page 1 of 1

[SOLVED] contents show with haschildren

Posted: Sun Jan 08, 2012 2:02 pm
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.

Re: contents show with haschildren

Posted: Sun Jan 08, 2012 3:36 pm
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}

Re: contents show with haschildren

Posted: Sun Jan 08, 2012 5:21 pm
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

Re: contents show with haschildren

Posted: Mon Jan 09, 2012 3:15 am
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...

Re: contents show with haschildren

Posted: Mon Jan 09, 2012 11:47 am
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!