代码如下 | 复制代码 |
function createsortoptions ($selected=0,$parent_id=0,$n=-1) { global $db; $sql = "select * from `@__article_sort` where `parent_id` = '{$parent_id}'"; $options = "; static $i = 0; if ($i == 0) { $options .= ' if ($row['sort_id'] == $selected) { $options .=' selected '; } $options .=">".str_repeat(' ',$n*3).$row['sort_name']." "; $options .=createsortoptions ($selected,$row['sort_id'],$n); } } return $options; } |
如果是用smarty模板的朋友可以如下调用
代码如下 | 复制代码 |
//– $tpl->assign('sort_list',createsortoptions ()); //– $tpl->assign('sort_list',createsortoptions ($sort_id)); |