Page 1 of 1

[SOLVED] $node->haschildren always return false

Posted: Wed Apr 13, 2011 6:43 am
by pustofkj
Hi all, I have simple hierarchy of my web pages. Just several pages in two levels and not every first level page has children. My menu template is following:

Code: Select all

{if $count > 0}
  <ul id="top_menu">
    {foreach from=$nodelist item=node}
      {if $node->depth > $node->prevdepth}
        {repeat string='<ul class="sub">' 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}

      <li{if $node->depth < 2} class="top"{/if}>
        <a href="{$node->url}">
          <span>{$node->hierarchy} - {$node->menutext} - {if $node->haschildren == true}y{else}n{/if}</span>
        </a>
    {/foreach}

    {repeat string="</li></ul>" times=$node->depth-1}
    </li>
  </ul>
{/if}
and it returns:

Code: Select all

5.1 - Šachy - n
  5.1.1 - A - Velmistrovský open - n
5.2 - Bridž - n
5.3 - Go - n
5.4 - Scrabble - n
5.5 - Mariáš - n
5.6 - Poker - n
5.7 - Rubikova kostka - n
5.8 - Backgammon - n
5.9 - Další hry - n
  5.9.1 - Dáma - n
  5.9.2 - Piškvorky - n
why it always writes "n" out? (it should writes "y" out in the first case - '5.1 - Šachy - y', isn't it?).

In my page template I call it this way:

Code: Select all

{menu template="czechopen-top-menu" childrenof="horni-navigace"}

Re: $node->haschildren always return false

Posted: Wed Apr 13, 2011 7:37 am
by RonnyK
on what version are you, as I recall that this stuff was fixed pre-1.9.4.1

Ronny

Re: $node->haschildren always return false

Posted: Wed Apr 13, 2011 7:59 am
by pustofkj
Hi again, I'm on 1.9.4.1 :-(

Re: $node->haschildren always return false

Posted: Wed Apr 13, 2011 9:08 am
by pustofkj
Thank you, I solved it with user defined tag - it's not so comfort, but working ;-)

Re: [SOLVED] $node->haschildren always return false

Posted: Wed Apr 13, 2011 11:19 am
by RonnyK
and what is -n, isnt that something that you put in the menu-title or so...

Ronny

Re: [SOLVED] $node->haschildren always return false

Posted: Thu Apr 14, 2011 5:10 am
by pustofkj
Yeah, following code produces "- n":

Code: Select all

{if $node->haschildren == true}y{else}n{/if}

Re: [SOLVED] $node->haschildren always return false

Posted: Thu Apr 14, 2011 8:49 am
by RonnyK
sorry, must be medication making me not see all stuff ;)

I will check it later....

Ronny