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


PHP CategoryModel::getTree方法代码示例

本文整理汇总了PHP中CategoryModel::getTree方法的典型用法代码示例。如果您正苦于以下问题:PHP CategoryModel::getTree方法的具体用法?PHP CategoryModel::getTree怎么用?PHP CategoryModel::getTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CategoryModel的用法示例。


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

示例1: renderCategory

 function renderCategory($id_category, $id_lang, $color = 'black')
 {
     $template = $this->template;
     $template->color_home = $color;
     $tmp = CategoryModel::getParents($id_category, $id_lang);
     $tmp = array_reverse($tmp);
     $tree = CategoryModel::getTree($id_lang);
     $template->parents = array();
     foreach ($tmp as $t) {
         $template->parents[] = $tree[$t];
     }
     $template->setFile(dirname(__FILE__) . '/eshop_category.latte');
     $template->render();
 }
开发者ID:oaki,项目名称:demoshop,代码行数:14,代码来源:BreadcrumbControl.php

示例2: renderSitemap

 public function renderSitemap()
 {
     $this->template->categories = CategoryModel::getTree($this->id_lang);
     $this->template->pages = $this->getService('Page')->getFluent()->where('visible = "0"')->fetchAll();
 }
开发者ID:oaki,项目名称:demoshop,代码行数:5,代码来源:Front_FeedPresenter.php

示例3: CategoryModel

/*
商品页
*/
define('ACC', true);
require '../system/init.php';
$cateObj = new CategoryModel();
$goodsObj = new GoodsModel();
$goodsID = $_GET['goods_id'];
$goodsInfo = $goodsObj->find($goodsID);
if (!isset($goodsInfo)) {
    header('Location: index.php');
}
//print_r(serialize($goodsInfo));
$catID = $goodsInfo['cat_id'];
$allCates = $cateObj->select();
$cateNav = $cateObj->getTree($allCates, $catID);
$cateInfo = $cateObj->find($catID);
//print_r($cateNav);
//加入浏览记录用cookie做
//是否有cookie,没有则设置,有则加入,超过5个自动删除
if (isset($_COOKIE['goods_history'])) {
    $history = _unserialize($_COOKIE['goods_history']);
    foreach ($history as $k => $v) {
        if ($v['goods_id'] != $goodsID) {
            continue;
        } else {
            array_splice($history, $k, 1);
            break;
        }
    }
    array_unshift($history, $goodsInfo);
开发者ID:qiushuiqs,项目名称:myshop,代码行数:31,代码来源:goods.php

示例4: exit

//print_r($_POST);
//第一步:后台检查数据
if (empty($_POST['cat_name'])) {
    exit('category name has to be set');
}
//第二步:接受数据
$cat_id = $_POST['cat_id'];
$data['cat_name'] = $_POST['cat_name'];
$data['dscrpt'] = $_POST['cat_desc'];
$data['parent_id'] = $_POST['parent_id'] + 0;
/*
检查修改后的数据是否引起闭环
*/
$cat = new CategoryModel();
$catlist = $cat->getList();
$trees = $cat->getTree($catlist, $data['parent_id']);
//echo $cat_id."修改后上层栏目页是".$data['parent_id']."<br>";
$canupdate = true;
foreach ($trees as $v) {
    if ($v['cat_id'] == $cat_id) {
        $canupdate = false;
    }
}
if (!$canupdate) {
    echo 'Error: Cannot update ' . $cat_id . '是' . $data['parent_id'] . '的祖先<br>';
    exit;
}
if ($cat->update($cat_id, $data) != -1) {
    echo "category updated successfully";
} else {
    echo "category updated unsuccessfully";
开发者ID:qiushuiqs,项目名称:myshop,代码行数:31,代码来源:catedoedit.php

示例5: renderSitemap

 public function renderSitemap()
 {
     $this->template->categories = CategoryModel::getTree(1);
 }
开发者ID:oaki,项目名称:demoshop,代码行数:4,代码来源:FeedPresenter.php


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