Back to CategoryNode class

Method getNumItems

public int
getNumItems
(mixed $recursive = false)
Returns the number of items.
Parameters
  • bool $recursive If false number of children, if true number of descendants
Returns
  • int Number of children or descendants
Since
  • 1.6
Class: CategoryNode
Project: Joomla

Method getNumItems - Source code

/**
 * Returns the number of items.
 *
 * @param   boolean  $recursive  If false number of children, if true number of descendants
 *
 * @return  integer  Number of children or descendants
 *
 * @since   1.6
 */
public function getNumItems($recursive = false)
{
    if ($recursive) {
        $count = $this->numitems;
        foreach ($this->getChildren() as $child) {
            $count = $count + $child->getNumItems(true);
        }
        return $count;
    }
    return $this->numitems;
}