From 2871360b5e89710071d92d544f0b313049f12fd5 Mon Sep 17 00:00:00 2001 From: Thomas Mudrunka Date: Fri, 9 Dec 2011 21:15:22 +0100 Subject: [PATCH] Vylepsena verze stromu kategorii --- assistants/category-tree.inc.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/assistants/category-tree.inc.php b/assistants/category-tree.inc.php index f268ca7..ce6c4c3 100644 --- a/assistants/category-tree.inc.php +++ b/assistants/category-tree.inc.php @@ -16,4 +16,14 @@ foreach($result as $row) { addleaf($tree, $row_parts); } -print_r($tree); +function render_tree($tree, $pathindex='__PATH__') { + if(!is_array($tree)) return ''; + $html=''; + foreach($tree as $name => $subtree) if($name != $pathindex) { + $html.='
  • '.$name.' ('.$subtree[$pathindex].')'.render_tree($subtree).'
  • '; + } + $html.='
    '; + return $html; +} +echo render_tree($tree); +//print_r($tree); -- 2.30.2