本文整理汇总了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;
}