JTableNested/isLeaf
From Joomla! Documentation
< API16:JTableNested
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Method to determine if a node is a leaf node in the tree (has no children).
Syntax[edit]
isLeaf($pk=null)
Parameter Name | Default Value | Description |
---|---|---|
$pk | null | Primary key of the node to check. |
Returns[edit]
boolean True if a leaf node.
Defined in[edit]
libraries/joomla/database/tablenested.php
Importing[edit]
jimport( 'joomla.database.tablenested' );
Source Body[edit]
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);
}
Examples[edit]
Code Examples[edit]