Пример #1
0
 /**
  * 搜索结果
  */
 public function word()
 {
     if (!Q("post.word")) {
         $this->error("请输入搜索关键字!");
     }
     $word = Q("post.word");
     $where = "cnname like '%" . $word . "%'";
     $db = K("video");
     $video = $db->lists_select($where);
     $category = K("category");
     $categorytop = $category->tops();
     $this->assign("categorytop", $categorytop);
     $array = $category->select();
     foreach ($video[0] as $key => $value) {
         $parentChannel = Data::parentChannel($array, $value["pid"]);
         foreach ($parentChannel as $v) {
             $video[0][$key]["cntitleF"] = $v["cntitle"];
             $video[0][$key]["entitleF"] = $v["entitle"];
         }
     }
     $this->assign("prefix", $this->upload_prefix());
     $this->assign("video", $video[0]);
     $this->assign("page", $video[1]);
     $this->display();
 }
Пример #2
0
 /**
  * 解析记录
  */
 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();
 }
Пример #3
0
 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');
 }
Пример #4
0
 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');
 }
Пример #5
0
 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;
 }
Пример #6
0
 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;
     }
 }
Пример #7
0
}
?>
</div>
<!--内容主体-->
<div class="content container">
<div class="row">
<div class="col-md-8">
    <!--内容主体-->
    <div id="main">
        <header>你的位置:

                    <?php 
$sep = "&nbsp;&gt;&nbsp;";
if (!empty($_REQUEST['cid'])) {
    $cat = cache("category");
    $cat = array_reverse(Data::parentChannel($cat, $_REQUEST['cid']));
    $str = "<a href='http://localhost/v5/plugin'>首页</a>&nbsp;&gt;&nbsp;";
    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>
Пример #8
0
 /**
  * 生成所有父级栏目
  * @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;
 }