[SOLVED] $node->haschildren always return false

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
pustofkj
Forum Members
Forum Members
Posts: 19
Joined: Fri Feb 04, 2011 1:57 pm

[SOLVED] $node->haschildren always return false

Post 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"}
Last edited by pustofkj on Wed Apr 13, 2011 9:09 am, edited 1 time in total.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: $node->haschildren always return false

Post by RonnyK »

on what version are you, as I recall that this stuff was fixed pre-1.9.4.1

Ronny
pustofkj
Forum Members
Forum Members
Posts: 19
Joined: Fri Feb 04, 2011 1:57 pm

Re: $node->haschildren always return false

Post by pustofkj »

Hi again, I'm on 1.9.4.1 :-(
pustofkj
Forum Members
Forum Members
Posts: 19
Joined: Fri Feb 04, 2011 1:57 pm

Re: $node->haschildren always return false

Post by pustofkj »

Thank you, I solved it with user defined tag - it's not so comfort, but working ;-)
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

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

Post by RonnyK »

and what is -n, isnt that something that you put in the menu-title or so...

Ronny
pustofkj
Forum Members
Forum Members
Posts: 19
Joined: Fri Feb 04, 2011 1:57 pm

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

Post by pustofkj »

Yeah, following code produces "- n":

Code: Select all

{if $node->haschildren == true}y{else}n{/if}
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

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

Post by RonnyK »

sorry, must be medication making me not see all stuff ;)

I will check it later....

Ronny
Post Reply

Return to “Modules/Add-Ons”