Actions

API15

JHTMLMenu/treerecurse

From Joomla! Documentation

< API15:JHTMLMenu
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.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Contents

Syntax

treerecurse($id, $indent, $list, &$children, $maxlevel=9999, $level=0, $type=1)
Parameter Name Default Value Description
$id
$indent
$list
&$children
$maxlevel 9999
$level 0
$type 1

Defined in

libraries/joomla/html/html/menu.php

Importing

jimport( 'joomla.html.html.menu' );

Source Body

function treerecurse( $id, $indent, $list, &$children, $maxlevel=9999, $level=0, $type=1 )
{
        if (@$children[$id] && $level <= $maxlevel)
        {
                foreach ($children[$id] as $v)
                {
                        $id = $v->id;
 
                        if ( $type ) {
                                $pre    = '<sup>|_</sup>&nbsp;';
                                $spacer = '.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                        } else {
                                $pre    = '- ';
                                $spacer = '&nbsp;&nbsp;';
                        }
 
                        if ( $v->parent == 0 ) {
                                $txt    = $v->name;
                        } else {
                                $txt    = $pre . $v->name;
                        }
                        $pt = $v->parent;
                        $list[$id] = $v;
                        $list[$id]->treename = "$indent$txt";
                        $list[$id]->children = count( @$children[$id] );
                        $list = JHTMLMenu::TreeRecurse( $id, $indent . $spacer, $list, $children, $maxlevel, $level+1, $type );
                }
        }
        return $list;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />