Tag: 嵌套集

获取修改的预定义树遍历模型(嵌套集)到<ul>中

我试图让我的数据是分层build立一个树遍历模型到一个<ul>为了显示在我的网站上。 这是我的代码: function getCats($) { // retrieve all children of $parent $query = "SELECT max(rght) as max from t_categories"; $row = C_DB::fetchSingleRow($query); $max = $row["max"]; $result ="<ul>"; $query = "SELECT * from t_categories where lft >=0 and rght <= $max"; if($rs = C_DB::fetchRecordset($query)){ $p_right =""; $p_left =""; $p_diff=""; while($row = C_DB::fetchRow($rs)){ $diff = $row["rght"] -$row["lft"]; […]