コード例 #1
0
ファイル: master.php プロジェクト: arunabh1911/ecom
function RecursiveCat($pid, $sel)
{
    $db = new myDBC();
    static $level = 0;
    static $strid = "";
    static $strname = "";
    $sql = $db->runQuery("select * from " . CATEGORY . " where parent_id =" . $pid . " ");
    while ($row = $db->getQuery($sql)) {
        $id = $row['page_id'];
        $level--;
        $pad = "";
        for ($p = 1; $p < $level * -1; $p++) {
            $pad .= "&nbsp;&nbsp;&nbsp;> ";
        }
        $ys = '';
        if ($sel == $row['page_id']) {
            $ys = 'selected';
        }
        $strname .= '<option ' . $ys . ' value="' . $row['page_id'] . '">' . $pad . ucwords($row['page_name']) . '</option>';
        $rid = RecursiveCat($id, $sel);
        $strid[] = $row['page_id'];
        $level++;
    }
    return $strname;
}
コード例 #2
0
function RecursiveCat($pid, $sel = '', $sel1)
{
    $db = new myDBC();
    if ($sel) {
        $cnd = "and category_parent!='{$sel}'";
    }
    static $level = 0;
    static $strid = "";
    static $strname = "";
    $sql = $db->runQuery("select * from " . CAT . " where category_parent='{$pid}' {$cnd} ");
    while ($row = $db->getQuery($sql)) {
        $id = $row['id'];
        $level--;
        $pad = "";
        for ($p = 1; $p < $level * -1; $p++) {
            $pad .= "&nbsp;&nbsp;&nbsp;> ";
        }
        $ys = '';
        if ($sel1 == $row['id']) {
            $ys = 'selected';
        }
        $strname .= '<option ' . $ys . ' value="' . $row['id'] . '">' . $pad . ucwords(strtolower($row['category_title'])) . '</option>';
        $rid = RecursiveCat($id, $sel, $sel1);
        $strid[] = $row['id'];
        $level++;
    }
    return $strname;
}