当前位置: 首页>>代码示例>>PHP>>正文


PHP cat_options函数代码示例

本文整理汇总了PHP中cat_options函数的典型用法代码示例。如果您正苦于以下问题:PHP cat_options函数的具体用法?PHP cat_options怎么用?PHP cat_options使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cat_options函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cat_options

function cat_options($id, $parent_id = 0, $level = 0)
{
    global $db, $prefix;
    $rows = $db->get_all("SELECT * FROM {$prefix}category WHERE parent_id = ? ORDER BY sort_order", array($parent_id));
    foreach ($rows as $row) {
        $selected = $id == $row['id'] ? 'selected' : '';
        echo "<option value=\"{$row[id]}\" {$selected} >" . str_repeat('&nbsp;', $level * 4) . "{$row[name]}</option>";
        cat_options($id, $row['id'], $level + 1);
    }
}
开发者ID:reake,项目名称:share-travel,代码行数:10,代码来源:lib_common.php

示例2: cat_list

/**
 * 获得指定分类下的子分类的数组
 *
 * @access  public
 * @param   int     $cat_id     分类的ID
 * @param   int     $selected   当前选中分类的ID
 * @param   boolean $re_type    返回的类型: 值为真时返回下拉列表,否则返回数组
 * @param   int     $level      限定返回的级数。为0时返回所有级数
 * @param   int     $is_show_all 如果为true显示所有分类,如果为false隐藏不可见分类。
 * @return  mix
 */
function cat_list($cat_id = 0, $selected = 0, $re_type = true, $level = 0, $is_show_all = true)
{
    static $res = NULL;
    if ($res === NULL) {
        $data = read_static_cache('cat_pid_releate');
        if ($data === false) {
            $sql = "SELECT c.cat_id, c.cat_name, c.measure_unit, c.parent_id, c.is_show, c.show_in_nav, c.grade, c.sort_order, COUNT(s.cat_id) AS has_children " . 'FROM ' . $GLOBALS['ecs']->table('category') . " AS c " . "LEFT JOIN " . $GLOBALS['ecs']->table('category') . " AS s ON s.parent_id=c.cat_id " . "GROUP BY c.cat_id " . 'ORDER BY c.parent_id, c.sort_order ASC';
            $res = $GLOBALS['db']->getAll($sql);
            $sql = "SELECT cat_id, COUNT(*) AS goods_num " . " FROM " . $GLOBALS['ecs']->table('goods') . " WHERE is_delete = 0 AND is_on_sale = 1 " . " GROUP BY cat_id";
            $res2 = $GLOBALS['db']->getAll($sql);
            $sql = "SELECT gc.cat_id, COUNT(*) AS goods_num " . " FROM " . $GLOBALS['ecs']->table('goods_cat') . " AS gc , " . $GLOBALS['ecs']->table('goods') . " AS g " . " WHERE g.goods_id = gc.goods_id AND g.is_delete = 0 AND g.is_on_sale = 1 " . " GROUP BY gc.cat_id";
            $res3 = $GLOBALS['db']->getAll($sql);
            $newres = array();
            foreach ($res2 as $k => $v) {
                $newres[$v['cat_id']] = $v['goods_num'];
                foreach ($res3 as $ks => $vs) {
                    if ($v['cat_id'] == $vs['cat_id']) {
                        $newres[$v['cat_id']] = $v['goods_num'] + $vs['goods_num'];
                    }
                }
            }
            foreach ($res as $k => $v) {
                $res[$k]['goods_num'] = !empty($newres[$v['cat_id']]) ? $newres[$v['cat_id']] : 0;
            }
            //如果数组过大,不采用静态缓存方式
            if (count($res) <= 1000) {
                write_static_cache('cat_pid_releate', $res);
            }
        } else {
            $res = $data;
        }
    }
    if (empty($res) == true) {
        return $re_type ? '' : array();
    }
    $options = cat_options($cat_id, $res);
    // 获得指定分类下的子分类的数组
    $children_level = 99999;
    //大于这个分类的将被删除
    if ($is_show_all == false) {
        foreach ($options as $key => $val) {
            if ($val['level'] > $children_level) {
                unset($options[$key]);
            } else {
                if ($val['is_show'] == 0) {
                    unset($options[$key]);
                    if ($children_level > $val['level']) {
                        $children_level = $val['level'];
                        //标记一下,这样子分类也能删除
                    }
                } else {
                    $children_level = 99999;
                    //恢复初始值
                }
            }
        }
    }
    /* 截取到指定的缩减级别 */
    if ($level > 0) {
        if ($cat_id == 0) {
            $end_level = $level;
        } else {
            $first_item = reset($options);
            // 获取第一个元素
            $end_level = $first_item['level'] + $level;
        }
        /* 保留level小于end_level的部分 */
        foreach ($options as $key => $val) {
            if ($val['level'] >= $end_level) {
                unset($options[$key]);
            }
        }
    }
    if ($re_type == true) {
        $select = '';
        foreach ($options as $var) {
            $select .= '<option value="' . $var['cat_id'] . '" ';
            $select .= $selected == $var['cat_id'] ? "selected='ture'" : '';
            $select .= '>';
            if ($var['level'] > 0) {
                $select .= str_repeat('&nbsp;', $var['level'] * 4);
            }
            $select .= htmlspecialchars(addslashes($var['cat_name']), ENT_QUOTES) . '</option>';
        }
        return $select;
    } else {
        foreach ($options as $key => $value) {
            $options[$key]['url'] = build_uri('category', array('cid' => $value['cat_id']), $value['cat_name']);
        }
//.........这里部分代码省略.........
开发者ID:YangZeSummer,项目名称:NanJingSecond-Hand,代码行数:101,代码来源:lib_common.php

示例3: cat_list

/**
 * 获得指定分类下的子分类的数组
 *
 * @access  public
 * @param   int     $cat_id     分类的ID
 * @param   int     $selected   当前选中分类的ID
 * @param   boolean $re_type    返回的类型: 值为真时返回下拉列表,否则返回数组
 * @param   int     $level      限定返回的级数。为0时返回所有级数
 * @param   int     $is_show_all 如果为true显示所有分类,如果为false隐藏不可见分类。
 * @return  mix
 */
function cat_list($cat_id = 0, $selected = 0, $re_type = true, $level = 0, $is_show_all = true)
{
    static $res = NULL;
    if ($res === NULL) {
        $sql = "SELECT c.*, COUNT(s.cat_id) AS has_children " . 'FROM ' . $GLOBALS['ecs']->table('category') . " AS c " . "LEFT JOIN " . $GLOBALS['ecs']->table('category') . " AS s ON s.parent_id=c.cat_id " . "GROUP BY c.cat_id " . 'ORDER BY parent_id, sort_order ASC';
        $res = $GLOBALS['db']->getAllCached($sql);
        $sql = "SELECT c.cat_id as cat_id, COUNT(g.goods_id) AS goods_num " . 'FROM ' . $GLOBALS['ecs']->table('category') . " AS c " . "LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ON g.cat_id=c.cat_id " . "GROUP BY c.cat_id ";
        $res2 = $GLOBALS['db']->getAllCached($sql);
        $newres = array();
        foreach ($res2 as $k => $v) {
            $newres[$v['cat_id']] = $v['goods_num'];
        }
        foreach ($res as $k => $v) {
            $res[$k]['goods_num'] = $newres[$v['cat_id']];
        }
    }
    if (empty($res) == true) {
        return $re_type ? '' : array();
    }
    $options = cat_options($cat_id, $res);
    // 获得指定分类下的子分类的数组
    $children_level = 99999;
    //大于这个分类的将被删除
    if ($is_show_all == false) {
        foreach ($options as $key => $val) {
            if ($val['level'] > $children_level) {
                unset($options[$key]);
            } else {
                if ($val['is_show'] == 0) {
                    unset($options[$key]);
                    if ($children_level > $val['level']) {
                        $children_level = $val['level'];
                        //标记一下,这样子分类也能删除
                    }
                } else {
                    $children_level = 99999;
                    //恢复初始值
                }
            }
        }
    }
    /* 截取到指定的缩减级别 */
    if ($level > 0) {
        if ($cat_id == 0) {
            $end_level = $level;
        } else {
            $first_item = reset($options);
            // 获取第一个元素
            $end_level = $first_item['level'] + $level;
        }
        /* 保留level小于end_level的部分 */
        foreach ($options as $key => $val) {
            if ($val['level'] >= $end_level) {
                unset($options[$key]);
            }
        }
    }
    if ($re_type == true) {
        $select = '';
        foreach ($options as $var) {
            $select .= '<option value="' . $var['cat_id'] . '" ';
            $select .= $selected == $var['cat_id'] ? "selected='ture'" : '';
            $select .= '>';
            if ($var['level'] > 0) {
                $select .= str_repeat('&nbsp;', $var['level'] * 4);
            }
            $select .= htmlspecialchars($var['cat_name'], ENT_QUOTES) . '</option>';
        }
        return $select;
    } else {
        foreach ($options as $key => $value) {
            $options[$key]['url'] = build_uri('category', array('cid' => $value['cat_id']), $value['cat_name']);
        }
        return $options;
    }
}
开发者ID:songtaiwu,项目名称:m-cmsold,代码行数:87,代码来源:lib_common.php

示例4: cat_list

/**
 * 获得指定分类下的子分类的数组
 *
 * @access  public
 * @param   int     $cat_id     分类的ID
 * @param   int     $selected   当前选中分类的ID
 * @param   boolean $re_type    返回的类型: 值为真时返回下拉列表,否则返回数组
 * @param   int     $level      限定返回的级数。为0时返回所有级数
 * @param   int     $is_show_all 如果为true显示所有分类,如果为false隐藏不可见分类。
 * @return  mix
 */
function cat_list($cat_id = 0, $selected = 0, $res, $res2, $re_type = true, $level = 0, $is_show_all = true)
{
    //static $res = NULL;
    /*
    		$db=D("cate");
    		if ($res === NULL)
        	{
    $sql = "SELECT c.*, COUNT(s.cat_id) AS has_children FROM __TABLE__ AS c LEFT JOIN __TABLE__ AS s ON s.parent_id=c.cat_id GROUP BY c.cat_id ORDER BY parent_id, sort_order ASC ";
    
    $res =$db->query($sql);
    			//dump($res);
    $sql = "SELECT c.cat_id as cat_id, COUNT(g.goods_id) AS goods_num FROM shuguang_cate AS c LEFT JOIN shuguang_goods AS g ON g.cat_id=c.cat_id GROUP BY c.cat_id ";
    $res2 = $db->query($sql);
    */
    //dump($res2);
    //if ($res === NULL){
    $newres = array();
    foreach ($res2 as $k => $v) {
        $newres[$v['cat_id']] = $v['goods_num'];
    }
    foreach ($res as $k => $v) {
        $res[$k]['goods_num'] = $newres[$v['cat_id']];
    }
    //}
    if (empty($res) == true) {
        return $re_type ? '' : array();
    }
    $options = cat_options($cat_id, $res);
    // 获得指定分类下的子分类的数组
    //dump($options);
    $children_level = 99999;
    //大于这个分类的将被删除
    if ($is_show_all == false) {
        foreach ($options as $key => $val) {
            if ($val['level'] > $children_level) {
                unset($options[$key]);
            } else {
                if ($val['is_show'] == 0) {
                    unset($options[$key]);
                    if ($children_level > $val['level']) {
                        $children_level = $val['level'];
                        //标记一下,这样子分类也能删除
                    }
                } else {
                    $children_level = 99999;
                    //恢复初始值
                }
            }
        }
    }
    /* 截取到指定的缩减级别 */
    if ($level > 0) {
        if ($cat_id == 0) {
            $end_level = $level;
        } else {
            $first_item = reset($options);
            //     获取第一个元素
            $end_level = $first_item['level'] + $level;
        }
        /* 保留level小于end_level的部分 */
        foreach ($options as $key => $val) {
            if ($val['level'] >= $end_level) {
                unset($options[$key]);
            }
        }
    }
    if ($re_type == true) {
        $select = '';
        foreach ($options as $var) {
            $select .= '<option value="' . $var['cat_id'] . '" ';
            $select .= $selected == $var['cat_id'] ? "selected='ture'" : '';
            $select .= '>';
            if ($var['level'] > 0) {
                $select .= str_repeat('&nbsp;', $var['level'] * 4);
            }
            $select .= htmlspecialchars($var['cat_name'], ENT_QUOTES) . '</option>';
        }
        return $select;
    } else {
        // dump($options );
        foreach ($options as $key => $value) {
            $options[$key]['url'] = build_uri('category', array('cid' => $value['cat_id']), $value['cat_name']);
        }
        return $options;
    }
}
开发者ID:rust1989,项目名称:ddsfilm,代码行数:97,代码来源:common.php

示例5: cat_list

/**
 * 获得指定分类下的子分类的数组
 *
 * @access  public
 * @param   int     $cat_id     分类的ID
 * @param   int     $selected   当前选中分类的ID
 * @param   boolean $re_type    返回的类型: 值为真时返回下拉列表,否则返回数组
 * @param   int     $level      限定返回的级数。为0时返回所有级数
 * @param   int     $is_show_all 如果为true显示所有分类,如果为false隐藏不可见分类。
 * @return  mix
 */
function cat_list($cat_id = 0, $selected = 0, $res, $res2, $re_type = true, $level = 0, $is_show_all = true)
{
    $newres = array();
    foreach ($res2 as $k => $v) {
        $newres[$v['cat_id']] = $v['goods_num'];
    }
    foreach ($res as $k => $v) {
        $res[$k]['goods_num'] = $newres[$v['cat_id']];
    }
    //}
    if (empty($res) == true) {
        return $re_type ? '' : array();
    }
    $options = cat_options($cat_id, $res);
    // 获得指定分类下的子分类的数组
    //dump($options);
    $children_level = 99999;
    //大于这个分类的将被删除
    if ($is_show_all == false) {
        foreach ($options as $key => $val) {
            if ($val['level'] > $children_level) {
                unset($options[$key]);
            } else {
                if ($val['is_show'] == 0) {
                    unset($options[$key]);
                    if ($children_level > $val['level']) {
                        $children_level = $val['level'];
                        //标记一下,这样子分类也能删除
                    }
                } else {
                    $children_level = 99999;
                    //恢复初始值
                }
            }
        }
    }
    /* 截取到指定的缩减级别 */
    if ($level > 0) {
        if ($cat_id == 0) {
            $end_level = $level;
        } else {
            $first_item = reset($options);
            //     获取第一个元素
            $end_level = $first_item['level'] + $level;
        }
        /* 保留level小于end_level的部分 */
        foreach ($options as $key => $val) {
            if ($val['level'] >= $end_level) {
                unset($options[$key]);
            }
        }
    }
    if ($re_type == true) {
        $select = '';
        foreach ($options as $var) {
            $select .= '<option value="' . $var['cat_id'] . '" ';
            $select .= $selected == $var['cat_id'] ? "selected='ture'" : '';
            $select .= '>';
            if ($var['level'] > 0) {
                $select .= str_repeat('&nbsp;', $var['level'] * 4);
            }
            $select .= htmlspecialchars($var['cat_name'], ENT_QUOTES) . '</option>';
        }
        return $select;
    } else {
        // dump($options );
        foreach ($options as $key => $value) {
            $options[$key]['url'] = build_uri('category', array('cid' => $value['cat_id']), $value['cat_name']);
        }
        return $options;
    }
}
开发者ID:dalinhuang,项目名称:concourse,代码行数:83,代码来源:common.php

示例6: cat_list

/**
 * 获得指定分类下的子分类的数组
 *
 * @access  public
 * @param   int     $cat_id     分类的ID
 * @param   int     $selected   当前选中分类的ID
 * @param   boolean $re_type    返回的类型: 值为真时返回下拉列表,否则返回数组
 * @param   int     $level      限定返回的级数。为0时返回所有级数
 * @param   int     $is_show_all 如果为true显示所有分类,如果为false隐藏不可见分类。
 * @return  mix
 */
function cat_list($cat_id = 0, $selected = 0, $re_type = true, $level = 0, $is_show_all = true) {
    static $res = NULL;

    if ($res === NULL) {
        $data = read_static_cache('cat_pid_releate');
        if ($data === false) {
            $res = model('Base')->get_all_cat_list();
            //如果数组过大,不采用静态缓存方式
            if (count($res) <= 1000) {
                write_static_cache('cat_pid_releate', $res);
            }
        } else {
            $res = $data;
        }
    }

    if (empty($res) == true) {
        return $re_type ? '' : array();
    }

    $options = cat_options($cat_id, $res); // 获得指定分类下的子分类的数组

    $children_level = 99999; //大于这个分类的将被删除
    if ($is_show_all == false) {
        foreach ($options as $key => $val) {
            if ($val['level'] > $children_level) {
                unset($options[$key]);
            } else {
                if ($val['is_show'] == 0) {
                    unset($options[$key]);
                    if ($children_level > $val['level']) {
                        $children_level = $val['level']; //标记一下,这样子分类也能删除
                    }
                } else {
                    $children_level = 99999; //恢复初始值
                }
            }
        }
    }

    /* 截取到指定的缩减级别 */
    if ($level > 0) {
        if ($cat_id == 0) {
            $end_level = $level;
        } else {
            $first_item = reset($options); // 获取第一个元素
            $end_level = $first_item['level'] + $level;
        }

        /* 保留level小于end_level的部分 */
        foreach ($options AS $key => $val) {
            if ($val['level'] >= $end_level) {
                unset($options[$key]);
            }
        }
    }

    if ($re_type == true) {
        $select = '';
        foreach ($options AS $var) {
            $select .= '<option value="' . $var['cat_id'] . '" ';
            $select .= ($selected == $var['cat_id']) ? "selected='ture'" : '';
            $select .= '>';
            if ($var['level'] > 0) {
                $select .= str_repeat('&nbsp;', $var['level'] * 4);
            }
            $select .= htmlspecialchars(addslashes($var['cat_name']), ENT_QUOTES) . '</option>';
        }

        return $select;
    } else {
        foreach ($options AS $key => $value) {
            $options[$key]['url'] = build_uri('category/index', array('id' => $value['cat_id']));
        }

        return $options;
    }
}
开发者ID:sayi21cn,项目名称:ecshopAndEctouch,代码行数:89,代码来源:function.php

示例7: search_cat

/**
 * 根据关键词搜索商品分类
 *
 * @access  public
 *
 * @return mix
 */
function search_cat()
{
    if (empty($_POST['cat_name'])) {
        return;
    }
    $res = NULL;
    // 根据类别名称进行模糊查询
    $sql = "SELECT c.cat_id, c.cat_name, c.measure_unit, c.parent_id, c.is_show, c.show_in_nav, c.grade, c.sort_order, COUNT(s.cat_id) AS has_children, 1 AS result " . 'FROM ' . $GLOBALS['ecs']->table('category') . " AS c " . "LEFT JOIN " . $GLOBALS['ecs']->table('category') . " AS s ON s.parent_id=c.cat_id " . "GROUP BY c.cat_id " . "HAVING c.cat_name LIKE '%" . $_POST['cat_name'] . "%' " . 'ORDER BY c.parent_id, c.sort_order ASC';
    $res = $GLOBALS['db']->getAll($sql);
    // 查询所有类别
    $sql = "SELECT c.cat_id, c.cat_name, c.measure_unit, c.parent_id, c.is_show, c.show_in_nav, c.grade, c.sort_order, COUNT(s.cat_id) AS has_children " . 'FROM ' . $GLOBALS['ecs']->table('category') . " AS c " . "LEFT JOIN " . $GLOBALS['ecs']->table('category') . " AS s ON s.parent_id=c.cat_id " . "GROUP BY c.cat_id " . 'ORDER BY c.parent_id, c.sort_order ASC';
    $res1 = $GLOBALS['db']->getAll($sql);
    // 构建一个全分类的Map集合<cat_id, cat>
    $cat_map = array();
    foreach ($res1 as $cat) {
        if (!empty($cat)) {
            $cat_id = $cat['cat_id'];
            $cat_map[$cat_id] = $cat;
        }
    }
    // 对商品类别进行排序
    $res1 = cat_options(0, $res1);
    // 获取查询结果的上级所有父类别
    $parents = array();
    $cat_result = array();
    foreach ($res as $cat) {
        $cat_result[$cat['cat_id']] = 1;
        array_push($parents, $cat);
        get_cat_parents($parents, $cat_map, $cat['cat_id']);
    }
    // 重构集合,只包含将来返回结果所包含的类别
    $cat_map = array();
    foreach ($parents as $cat) {
        $cat_map[$cat['cat_id']] = $cat;
    }
    // 移除与查询结果无关的类别
    $res = array();
    foreach ($res1 as $cat) {
        if (!empty($cat_map[$cat['cat_id']])) {
            // 标识出匹配查询条件的结果
            if (empty($cat_result[$cat['cat_id']])) {
                $cat['is_result'] = 2;
            } else {
                $cat['is_result'] = 1;
            }
            array_push($res, $cat);
        }
    }
    file_put_contents("D:/php.debug", var_export($res, true));
    return $res;
}
开发者ID:moonlight-wang,项目名称:feilun,代码行数:58,代码来源:category.php

示例8: cat_list

 /**
  * 获得指定分类下的子分类的数组
  *
  * @access  public
  * @param   int     $cat_id     分类的ID
  * @param   int     $selected   当前选中分类的ID
  * @param   boolean $re_type    返回的类型: 值为真时返回下拉列表,否则返回数组
  * @param   int     $level      限定返回的级数。为0时返回所有级数
  * @param   int     $is_show_all 如果为true显示所有分类,如果为false隐藏不可见分类。
  * @return  mix
  */
 function cat_list($cat_id = 0, $selected = 0, $re_type = true, $level = 0, $is_show_all = true)
 {
     static $res = NULL;
     if ($res === NULL) {
         $data = read_static_cache('cat_pid_releate');
         if ($data === false) {
             $res = M('category')->alias('c')->field('c.cat_id, c.cat_name, c.measure_unit, c.parent_id, c.is_show, c.show_in_nav, c.grade, c.sort_order, COUNT(s.cat_id) AS has_children')->join(C('DB_PREFIX') . 'category s ON s.parent_id=c.cat_id')->group('c.cat_id')->order('c.parent_id, c.sort_order ASC')->select();
             $res2 = M('goods')->field('cat_id, COUNT(*) AS goods_num')->where(array('is_delete' => 0, 'is_on_sale' => 1))->group('cat_id')->select();
             $res3 = M('goods_cat')->alias('gc')->field('gc.cat_id, COUNT(*) AS goods_num')->join(C('DB_PREFIX') . 'goods g ON g.goods_id = gc.goods_id')->where(array('g.goods_id = gc.goods_id AND g.is_delete = 0 AND g.is_on_sale = 1'))->select();
             $newres = array();
             foreach ($res2 as $k => $v) {
                 $newres[$v['cat_id']] = $v['goods_num'];
                 foreach ($res3 as $ks => $vs) {
                     if ($v['cat_id'] == $vs['cat_id']) {
                         $newres[$v['cat_id']] = $v['goods_num'] + $vs['goods_num'];
                     }
                 }
             }
             foreach ($res as $k => $v) {
                 $res[$k]['goods_num'] = !empty($newres[$v['cat_id']]) ? $newres[$v['cat_id']] : 0;
             }
             //如果数组过大,不采用静态缓存方式
             if (count($res) <= 1000) {
                 write_static_cache('cat_pid_releate', $res);
             }
         } else {
             $res = $data;
         }
     }
     if (empty($res) == true) {
         return $re_type ? '' : array();
     }
     $options = cat_options($cat_id, $res);
     // 获得指定分类下的子分类的数组
     $children_level = 99999;
     //大于这个分类的将被删除
     if ($is_show_all == false) {
         foreach ($options as $key => $val) {
             if ($val['level'] > $children_level) {
                 unset($options[$key]);
             } else {
                 if ($val['is_show'] == 0) {
                     unset($options[$key]);
                     if ($children_level > $val['level']) {
                         $children_level = $val['level'];
                         //标记一下,这样子分类也能删除
                     }
                 } else {
                     $children_level = 99999;
                     //恢复初始值
                 }
             }
         }
     }
     /* 截取到指定的缩减级别 */
     if ($level > 0) {
         if ($cat_id == 0) {
             $end_level = $level;
         } else {
             $first_item = reset($options);
             // 获取第一个元素
             $end_level = $first_item['level'] + $level;
         }
         /* 保留level小于end_level的部分 */
         foreach ($options as $key => $val) {
             if ($val['level'] >= $end_level) {
                 unset($options[$key]);
             }
         }
     }
     if ($re_type == true) {
         $select = '';
         foreach ($options as $var) {
             $select .= '<option value="' . $var['cat_id'] . '" ';
             $select .= $selected == $var['cat_id'] ? "selected='ture'" : '';
             $select .= '>';
             if ($var['level'] > 0) {
                 $select .= str_repeat('&nbsp;', $var['level'] * 4);
             }
             $select .= htmlspecialchars(addslashes($var['cat_name']), ENT_QUOTES) . '</option>';
         }
         return $select;
     } else {
         foreach ($options as $key => $value) {
             $options[$key]['url'] = build_uri('category', array('cid' => $value['cat_id']), $value['cat_name']);
         }
         return $options;
     }
 }
开发者ID:highestgoodlikewater,项目名称:ecshoptk,代码行数:100,代码来源:IndexController.class.php

示例9: cat_options

<div class="main-div">
  <form action="?act=<?php 
echo $form_act;
?>
" method="post">
  	<input type="hidden" name="id" value="<?php 
echo $id;
?>
" />
    <table width="100%" id="general-table">
      <tr>
        <td class="label">上级分类</td>
        <td><select name="parent_id" id="parent_id" tabindex="1">
            <option value="0">顶级分类</option>
            <?php 
cat_options($parent_id);
?>
          </select></td>
      </tr>
      <tr>
        <td class="label">分类名称</td>
        <td><input type="text" name="name" id="name" tabindex="2" value="<?php 
echo $name;
?>
" /></td>
      </tr>
      <tr>
        <td class="label">跳转链接</td>
        <td><input type="text" name="url" id="url" tabindex="3" value="<?php 
echo $url;
?>
开发者ID:reake,项目名称:share-travel,代码行数:31,代码来源:category_info.php

示例10: cat_options

<div class="main-div">
  <form action="?act=<?php 
echo $form_act;
?>
" method="post">
  	<input type="hidden" name="uid" value="<?php 
echo $uid;
?>
" />
    <table width="100%" id="general-table">
      <tr>
        <td class="label">网站分类:</td>
        <td><select name="cat_id" id="cat_id" tabindex="1">
          <option value="0">顶级分类</option>
          <?php 
echo cat_options($cat_id);
?>
        </select></td>
      </tr>
      <tr>
        <td class="label">网站名称:</td>
        <td><input type="text" name="title" id="title" tabindex="2" value="<?php 
echo $title;
?>
" /></td>
      </tr>
      <tr>
        <td class="label">网站地址:</td>
        <td><input type="text" name="url" id="url" tabindex="3" value="<?php 
echo $url ? $url : 'http://';
?>
开发者ID:reake,项目名称:share-travel,代码行数:31,代码来源:url_info.php


注:本文中的cat_options函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。