db_selectOne($table_prefix."term_taxonomy","parent","taxonomy='category' and term_id=".$cat); $parents=array(); if($taxonomy!==false) { if($taxonomy["parent"]!=0) { $parents2=get_parents_list($taxonomy["parent"]); foreach($parents2 as $p) $parents[]=$p; } } else die("cateory not found:".$cat); $parents[]=$cat; return $parents; } function sub_string_max($str,$max=100) { if(strlen($str)>$max) return "

".mb_convert_encoding(substr($str,0,$max, 'ISO-8859-1', 'UTF-8'))."...

"; return "

".mb_convert_encoding($str, 'ISO-8859-1', 'UTF-8')."

"; } function get_cat_tree($curParent=0) { global $table_prefix,$db; $categories=array(); $taxonomy=$db->db_select($table_prefix."term_taxonomy","term_taxonomy_id ,term_id,taxonomy","taxonomy='category' and parent=".$curParent); if($taxonomy!==false) foreach($taxonomy as $t) { $cat=$db->db_selectOne($table_prefix."terms","term_id,name","term_id='".$t["term_id"]."'"); if($cat!==false) $categories[]=array("id"=>$cat["term_id"],"title"=>htmlentities($cat["name"]),"childs"=>get_cat_tree($t["term_taxonomy_id"])); } return $categories; } function xml_str_encode($str) { return str_replace("&","&",str_replace("&","&",str_replace("'","'",mb_convert_encoding(strip_tags(str_replace("

","
",$str, 'ISO-8859-1', 'UTF-8'),"
"))))); } function xml_str($str) { return "","
",$str),"
")))))." ]]>"; } function xml_str2($str) { return "","
",$str, 'ISO-8859-1', 'UTF-8'),"
")))))." ]]>"; } function xml_str0($str) { return "","
",$str),"


")." ]]>"; } function display_cat_tree($categories_lis,$field,$level=0) { if($level==0) { echo '