$SQL = "SELECT catid,offerid ,cat FROM " . CAT_TB . " WHERE pid=" . $SecondCat[1]; $Mysql = new Mysql(DB_NAME); $Mysql->doQuery($SQL); while ($obj = $Mysql->GetData()) { if ($SecondCat[1] == $obj->catid) { $class = "class='cur-menu'"; } else { $class = ""; } echo "<li " . $class . "><a href='/index.php?gOo=goods_category.dwt&gcat=" . $obj->catid . "' >" . $obj->cat . "</li>\n"; //建立三级目录 if ($_GET['pid'] == $obj->catid) { echo "<ul id='catmenu'>\n"; $SQL2 = "SELECT catid,offerid ,cat FROM " . CAT_TB . " WHERE pid=" . $obj->catid; $Mysql2 = new Mysql(DB_NAME); $Mysql2->doQuery($SQL2); while ($obj2 = $Mysql2->GetData()) { if ($_GET['pid'] == $obj2->catid) { $class = "class='cur-menu'"; } else { $class = ""; } echo "<li " . $class . "><a href='/index.php?gOo=goods_category.dwt&gcat=" . $obj2->catid . "&sub=" . $obj2->catid . "' >" . $obj2->cat . "</li>\n"; } echo "</ul>"; } } } else { } } }
$Mysql2 = new Mysql(DB_NAME); $Mysql2->doQuery($SQL2); $curl .= "<ul id='menu-sub-" . $obj->cat_id . "' class='childli' style='display:none;'>\n"; $ulid_list .= $obj->cat_id . ","; while ($obj2 = $Mysql2->GetData()) { $curl .= "<li class='class-2' id='menu-a-" . $obj->cat_id . "' >"; $curl .= "<a id='li-a-" . $obj2->cat_id . "' href='" . HOME_URL . "/index.php?gOo=goods_category.dwt&gcat=" . $obj2->cat_id . "' >" . $obj2->cat . "</a>"; } $curl .= "</ul>"; $curl .= "</li>\n"; $lastpid = $obj->pid; $i++; } $curl .= "<li class='menu-bt'></li>"; $curl .= "</ul>"; echo $curl; if ($_GET['goodsid'] != '') { $SQL = "SELECT cat_id FROM " . GOODS_TB . " WHERE gid=" . $_GET['goodsid']; $Mysql = new Mysql(DB_NAME); $Mysql->doQuery($SQL); $obj = $Mysql->GetData(); $goodscat = $obj->cat_id; $SQL = "SELECT pid FROM " . NEW_CAT_TB . " WHERE cat_id=" . $goodscat . " ORDER BY catord ASC"; $Mysql = new Mysql(DB_NAME); $Mysql->doQuery($SQL); $obj = $Mysql->GetData(); $pid = $obj->pid; echo "<div id='cat_ul_list' style='display:none'>" . $pid . "</div>"; } echo "<div id='ul_list' style='display:none'>" . $ulid_list . "</div>"; echo "<div id='goodscat' style='display:none'>" . $goodscat . "</div>";