<BR>/*—————————————————— */ <BR>//– 递归实现无限分类生成下拉列表函数 <BR>//– $tpl->assign('sort_list',createSortOptions ()); <BR>//– $tpl->assign('sort_list',createSortOptions ($sort_id)); <BR>/*—————————————————— */ <BR>function createSortOptions ($selected=0,$parent_id=0,$n=-1) <BR>{ <BR>global $db; <BR>$sql = "SELECT * FROM `@__article_sort` WHERE `parent_id` = '{$parent_id}'"; <BR>$options = "; <BR>static $i = 0; <BR>if ($i == 0) <BR>{ <BR>$options .= '请选择'; <BR>} <BR>$res = $db->query ($sql); <BR>if ($res) <BR>{ <BR>$n++; <BR>while ($row = $db->fetch_assoc ($res)) <BR>{ <BR>$i++; <BR>$options .="<option value='{$row['sort_id']}'"; <BR>if ($row['sort_id'] == $selected) <BR>{ <BR>$options .=' selected '; <BR>} <BR>$options .=">".str_repeat(' ',$n*3).$row<div style="color:transparent">!本文来源gaodai.ma#com搞##代!^码网(</div><sup>搞gaodaima代码</sup>['sort_name']."\n"; <BR>$options .=createSortOptions ($selected,$row['sort_id'],$n); <BR>} <BR>} <BR>return $options; <BR>} <BR>