本文整理匯總了PHP中Data::parentChannel方法的典型用法代碼示例。如果您正苦於以下問題:PHP Data::parentChannel方法的具體用法?PHP Data::parentChannel怎麽用?PHP Data::parentChannel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Data
的用法示例。
在下文中一共展示了Data::parentChannel方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
/**
* 解析記錄
*/
public function index()
{
$video = K("video")->field("vid,cnname,enname,uploadtime,py_video.cid,cntitle,entitle,pid,uid")->where(array("uid" => Q("session.uid")))->select();
$category = M("category")->select();
foreach ($video as $key => $value) {
$parentChannel = Data::parentChannel($category, $value["pid"]);
foreach ($parentChannel as $v) {
$video[$key]["cntitleF"] = $v["cntitle"];
}
}
$this->assign("video", $video);
$this->display();
}
示例2: index
public function index()
{
//組裝地址後綴
if (!isset($_GET['s'])) {
$this->formatUrl();
}
//讀取當前分類信息
$field = $this->db->getOne(Q('cate_id'));
View::with('field', $field);
//讀取當前分類下的所有品牌
$brand = new \Home\Model\Brand();
$brandData = $brand->getRel(Q('cate_id'));
View::with('brandData', $brandData);
//讀取該分類下所有商品對應的規格屬性
$cateAttr = $this->assignCateAttr();
View::with('cateAttr', $cateAttr);
//根據篩選條件分配商品信息
$goodsData = $this->getGoods();
View::with('goodsData', $goodsData);
//全部商品分類
$cateData = $this->db->getChan();
// p($cateData);
View::with('cateData', $cateData);
//分配相關分類
$data = $this->db->getAll();
$d = Data::parentChannel($data, $_GET['cate_id'], 'cate_id', 'pid');
foreach ($d as $key => $v) {
if ($v['pid'] == 0) {
$cateRel = $this->db->getRel($v['cate_id']);
}
}
View::with('cateRel', $cateRel);
//最近瀏覽商品
$goods = new \Home\Model\Goods();
$viewData = $goods->recentView();
View::with('viewData', $viewData);
//最新發布商品
$new = $goods->getNew();
View::with('new', $new);
View::make($this->tpl . 'lists.html');
}
示例3: index
public function index()
{
//商品主要數據
$goodsData = $this->db->getOne(Q('goods_id'));
if (!$goodsData) {
echo '沒有此商品記錄';
exit;
}
View::with('goodsData', $goodsData);
//最近瀏覽
$viewData = $this->db->recentView();
View::with('viewData', $viewData);
//最新發布商品
$new = $this->db->getNew();
View::with('new', $new);
//縮略圖數據
$pics = new \Home\Model\Pics();
$picsData = $pics->getAll(Q('goods_id'));
View::with('picsData', $picsData);
//商品屬性數據
$im_attr = Db::table('goods_attr ga')->join('shop_attr sa', 'ga.attr_id', '=', 'sa.attr_id')->where('goods_id', Q('goods_id'))->where('sa.attr_type', 2)->groupBy('sa.attr_id')->get();
View::with('im_attr', $im_attr);
//取當前商品的全部規格屬性
$goods_attr = Db::table('goods_attr')->where('goods_id', $goodsData['goods_id'])->get();
View::with('goods_attr', $goods_attr);
//全部商品分類
$cate = new \Home\Model\Cate();
$cateData = $cate->getChan();
// p($cateData);
View::with('cateData', $cateData);
//分配相關分類
$data = $cate->getAll();
$d = Data::parentChannel($data, $goodsData['cate_id'], 'cate_id', 'pid');
foreach ($d as $key => $v) {
if ($v['pid'] == 0) {
$cateRel = $cate->getRel($v['cate_id']);
}
}
View::with('cateRel', $cateRel);
View::make($this->tpl . 'goods.html');
}
示例4: createHtml
private function createHtml($aid)
{
$content = ContentViewModel::getInstance($this->mid)->getOne($aid);
$html = new Html();
//內容靜態
$html->content($content);
//生成欄目
$category = Data::parentChannel($this->category, $content['cid']);
//生成當前欄目
$html->relation_category($content['cid']);
foreach ($category as $cat) {
$html->relation_category($cat['cid']);
}
//生成首頁
$html->index();
return true;
}
示例5: delCategory
public function delCategory($cid)
{
if (!$cid || !isset($this->category[$cid])) {
$this->error = 'cid參數錯誤';
return false;
}
//如果存在子欄目不進行刪除
if (M('category')->where(array('pid' => $cid))->find()) {
$this->error = '請先刪除子欄目';
return false;
}
$ContentModel = ContentModel::getInstance($this->category[$cid]['mid']);
$ContentModel->where(array('cid' => $cid))->del();
//刪除欄目權限
M("category_access")->where("cid={$cid}")->del();
//刪除欄目
if ($this->del($cid)) {
$html = new Html();
//生成首頁
$html->index();
//更新父級欄目
$parentCategory = Data::parentChannel(S('category'), $cid);
if (!empty($parentCategory)) {
foreach ($parentCategory as $cat) {
$html->relation_category($cat['cid']);
}
}
//更新緩存
$this->updateCache();
return true;
} else {
$this->error = '刪除失敗';
return false;
}
}
示例6: cache
}
?>
</div>
<!--內容主體-->
<div class="content container">
<div class="row">
<div class="col-md-8">
<!--內容主體-->
<div id="main">
<header>你的位置:
<?php
$sep = " > ";
if (!empty($_REQUEST['cid'])) {
$cat = cache("category");
$cat = array_reverse(Data::parentChannel($cat, $_REQUEST['cid']));
$str = "<a href='http://localhost/v5/plugin'>首頁</a> > ";
foreach ($cat as $c) {
$str .= "<a href='" . Url::getCategoryUrl($c) . "'>" . $c['catname'] . "</a>" . $sep;
}
echo substr($str, 0, -strlen($sep));
}
?>
</header>
<div class="title">
<h2><?php
echo $hdcms['title'];
?>
</h2>
<p>
示例7: parent_category
/**
* 生成所有父級欄目
* @param $cid
* @return bool
*/
public function parent_category($cid)
{
$parent = Data::parentChannel($this->category, $cid);
if (!$parent) {
return;
}
foreach ($parent as $p) {
$this->relation_category($p['cid']);
}
return true;
}