use CATEGORIES Category GetCategoriesTree echo CreateMenuTree CATEGORI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// use...
$CATEGORIES = Category::GetCategoriesTree();
echo CreateMenuTree( $CATEGORIES );
// function...
function CreateMenuTree( $CATEGORIES ){
ob_start();
echo '<ul>';
foreach( $CATEGORIES as $Category ){
echo '<li>';
echo '<a>' . $Category[ 'NAME' ] . '</a>';
if ( is_array( $Category[ 'CHILDREN' ] ) ){
echo CreateMenuTree( $Category[ 'CHILDREN' ] );
}
echo '</li>';
}
echo '</ul>';
$result = ob_get_contents();
ob_end_clean();
return $result;
}