Actions

API16

JTableNested/isLeaf

From Joomla! Documentation

< API16:JTableNested
Revision as of 17:43, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Method to determine if a node is a leaf node in the tree (has no children).

[Edit Descripton]

Description:JTableNested/isLeaf

Syntax

isLeaf($pk=null)
Parameter Name Default Value Description
$pk null Primary key of the node to check.

Returns

boolean True if a leaf node.

Defined in

libraries/joomla/database/tablenested.php

Importing

jimport( 'joomla.database.tablenested' );

Source Body

public function isLeaf($pk = null)
{
        // Initialise variables.
        $k = $this->_tbl_key;
        $pk = (is_null($pk)) ? $this->$k : $pk;
 
        // Get the node by primary key.
        if (!$node = $this->_getNode($pk)) {
                // Error message set in getNode method.
                return false;
        }
 
        // The node is a leaf node.
        return (($node->rgt - $node->lft) == 1);
}

[Edit See Also] SeeAlso:JTableNested/isLeaf

Examples

<CodeExamplesForm />