本文整理汇总了PHP中CategoryModel::getCatTree方法的典型用法代码示例。如果您正苦于以下问题:PHP CategoryModel::getCatTree方法的具体用法?PHP CategoryModel::getCatTree怎么用?PHP CategoryModel::getCatTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CategoryModel
的用法示例。
在下文中一共展示了CategoryModel::getCatTree方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: goodsByCate
public function goodsByCate($cateID, $n = null, $start = null)
{
$cateObj = new CategoryModel();
$allCates = $cateObj->select();
$cateList = $cateObj->getCatTree($allCates, $cateID);
$cateIDList = array($cateID);
foreach ($cateList as $v) {
$cateIDList[] = $v['cat_id'];
}
$instring = implode(',', $cateIDList);
$sql = 'select goods_id,goods_name, shop_price, market_price, thumb_img, add_time, goods_img from ' . $this->table . ' where cat_id in (' . $instring . ') order by add_time desc';
if (is_numeric($n) && is_numeric($start)) {
$sql .= ' limit ' . $start . ',' . $n;
}
$data = $this->db->getAll($sql);
return $data;
}
示例2: CategoryModel
<?php
define('ACC', true);
require '../system/init.php';
//echo __ROOT__;exit;
$cat = new CategoryModel();
$catlist = $cat->getList();
$cattree = $cat->getCatTree($catlist, 0);
include __ROOT__ . 'view/admin/templates/goodsadd.html';
示例3: define
<?php
/*
后台文件
Background entry file
*/
if (!defined('ACC')) {
define('ACC', true);
require '../system/init.php';
}
//
$cat = new CategoryModel();
$catelist = $cat->getList();
//print_r($catelist);
$catetree = $cat->getCatTree($catelist, 0);
//print_r($catetree);
include __ROOT__ . 'view/admin/templates/catelist.html';
示例4: CategoryModel
/*
栏目页。
*/
define('ACC', true);
require '../system/init.php';
$cateObj = new CategoryModel();
$goodsObj = new GoodsModel();
$catID = $_GET['cat_id'];
$cateInfo = $cateObj->find($catID);
if (!isset($cateInfo)) {
header('Location: index.php');
}
//树状导航
$allCates = $cateObj->select();
$cateList = $cateObj->getCatTree($allCates, 0, 1);
//面包屑导航
$cateNav = $cateObj->getTree($allCates, $catID);
//print_r($cateNav);
//分页显示
$curPage = isset($_GET['page']) ? $_GET['page'] : 1;
$goodsCnt = count($goodsObj->goodsByCate($catID));
$perPage = 4;
$pageObj = new PaginationHelper($goodsCnt, $perPage, $curPage);
$pageMenu = $pageObj->showPageMenu();
//取出栏目下的商品
$goodsList = $goodsObj->goodsByCate($catID, $perPage, ($curPage - 1) * $perPage);
//浏览记录
if (isset($_COOKIE['goods_history'])) {
$goods_history = _unserialize($_COOKIE['goods_history']);
}