1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Check a category/node has children or not

Discussion in 'XenForo Questions and Support' started by razon.05, Jun 20, 2012.

  1. razon.05

    razon.05 New Member

    What is the code to check a node has children or not? Currently i can get the node depth by {$node.depth} but how to find it's a parent of other node?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There is no explicit "is parent" flag for nodes, but this should work:

    Code:
    {$node.rgt} == {$node.lft} + 1
    
    If this condition is true then the node has no children. You can use this in a template conditional:

    Code:
    <xen:if is="{$node.rgt} == {$node.lft} + 1">
    
    </xen:if>
    
     
    razon.05 likes this.

Share This Page