$category_tree, * 'open_path' => [1 ,2] * ]); * * ----------------------------------------------------------------------------- */ /** tree_ul * creates (recursively) a nested ul-li tree of categories * --- -- -- - - - * @param $tree (array) : categories array formated as tree * @param $open_nodes (array) : array of categor ids that shall be marked open/selected * @return $html (string) */ function tree_li($tree, $open_nodes = [], $l = 0) { $html = ""; foreach($tree as $node) { // if has childs ... // write li ; traverse children recursively if ((isset($node['childs'])) && ( $node['childs']!= [])) { if (in_array(intval($node['rec']['id']), $open_nodes)) { $inner_class = "inner show"; $sign = "–"; $a_class = "has-childs selected"; } else { $inner_class = "inner"; $sign = "+"; $a_class = "has-childs"; } $html .= "