本文主要是介绍destoon分类树状列表,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在使用destoon的过程中要制作一些小工具,会用到模块下的分类,如果使用系统自己带的,需要引入一大批js,对于小工具来说就有点臃肿了那么如何调用来他的分类列表出来呢,制作了一个小函数
具体代码与使用方法见下方
<?
define('IN_DESTOON', true);
require 'common.inc.php';function InitClassSelectOption($ParentID,$ChkID,$db)
{$sql="SELECT * from dt_category where moduleid=5 and parentid=".$ParentID;$options="";$result = $db->query($sql);//$r = $db->fetch_array($result);//var_dump($r);while($r = $db->fetch_array($result)){echo "<option ";if($ChkID==$r['catid']) echo " selected='selected' ";echo ">";$parent=$r["arrparentid"];$tmp=explode(",",$parent);for($i=0;$i<count($tmp);$i++){ echo " ";}echo "├" . $r['catname']." </option>";InitClassSelectOption($r["catid"],$ChkID,$db);}
}
?>
<select>
<?php
echo InitClassSelectOption(0,18,$db);
?>
</select>
这篇关于destoon分类树状列表的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!