动态显示某张表的分类ID
function showclassID($tbname,$bclassid=0) { global $empire; //导航字符 if (empty($bclassid)) { $to='|-'; } else { $to=' |-'; } $query='select * from phome_enewsclass where tbname=''.$tbname.'' and bclassid=''.$bclassid.''order by classid'; $sql=$empire->query ($query); while($r=$empire->fetch($sql)) { //是否终极分类 if ($r[islast]==0) { $bg=' style=background-color:efefef'; } else { $bg=' style=background-color:99C4E3'; } $showclass.='<option value='.$r[classid] .$bg.'>'.$to.$r[classname].'</option>'; //再替换一次 $showclass.=showclassID($tbname,$r[classid]); } return $showclass; }
具体调用 showclassID("表名");
|