本文整理汇总了PHP中kernel::mkUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP kernel::mkUrl方法的具体用法?PHP kernel::mkUrl怎么用?PHP kernel::mkUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kernel
的用法示例。
在下文中一共展示了kernel::mkUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMap
function getMap($depth = -1, $cat_id = 0)
{
$var_depth = $depth;
$var_cat_id = $cat_id;
if (isset($this->catMap[$var_depth][$var_cat_id])) {
return $this->catMap[$var_depth][$var_cat_id];
}
if ($cat_id > 0) {
$row = $this->db->select('select cat_path from sdb_b2c_goods_cat where cat_id=' . intval($cat_id));
if ($depth > 0) {
$depth += substr_count($row['cat_path'], ',');
}
$rows = $this->db->select('select cat_name,cat_id,parent_id,is_leaf,cat_path,type_id from sdb_b2c_goods_cat where cat_path like "' . $row['cat_path'] . $cat_id . '%" order by cat_path,p_order');
} else {
$rows = $this->db->select('select cat_name,cat_id,parent_id,is_leaf,cat_path,type_id from sdb_b2c_goods_cat order by p_order');
}
$cats = array();
$ret = array();
foreach ($rows as $k => $row) {
if ($depth < 0 || substr_count($row['cat_path'], ',') < $depth) {
$cats[$row['cat_id']] = array('type' => 'gcat', 'parent_id' => $row['parent_id'], 'title' => $row['cat_name'], 'link' => kernel::mkUrl('gallery', 'index', array($row['cat_id'])));
}
}
foreach ($cats as $cid => $cat) {
if ($cat['parent_id'] == $cat_id) {
$ret[] =& $cats[$cid];
} else {
$cats[$cat['parent_id']]['items'][] =& $cats[$cid];
}
}
$this->catMap[$var_depth][$var_cat_id] = $ret;
return $ret;
}
示例2: getMap
/**
* 得到分类的树形结构图
* @param string depth
* @param int cat_id
* @return mixed 结果数据
*/
public function getMap($depth = -1, $cat_id = 0)
{
$var_depth = $depth;
$var_cat_id = $cat_id;
if (isset($this->catMap[$var_depth][$var_cat_id])) {
return $this->catMap[$var_depth][$var_cat_id];
}
if ($cat_id > 0) {
$row = $this->getList('cat_path', array('cat_id' => intval($cat_id)));
if ($depth > 0) {
$depth += substr_count($row['cat_path'], ',');
}
$rows = $this->getList('cat_name,cat_id,parent_id,is_leaf,cat_path,type_id', array('cat_path|head' => $row['cat_path'] . $cat_id), 0, -1, 'cat_path,p_order ASC');
} else {
$rows = $this->getList('cat_name,cat_id,parent_id,is_leaf,cat_path,type_id', array(), 0, -1, 'p_order ASC');
}
$cats = array();
$ret = array();
foreach ($rows as $k => $row) {
if ($depth < 0 || substr_count($row['cat_path'], ',') < $depth) {
$cats[$row['cat_id']] = array('type' => 'gcat', 'parent_id' => $row['parent_id'], 'title' => $row['cat_name'], 'link' => kernel::mkUrl('gallery', 'index', array($row['cat_id'])));
}
}
foreach ($cats as $cid => $cat) {
if ($cat['parent_id'] == $cat_id) {
$ret[] =& $cats[$cid];
} else {
$cats[$cat['parent_id']]['items'][] =& $cats[$cid];
}
}
$this->catMap[$var_depth][$var_cat_id] = $ret;
return $ret;
}