예제 #1
0
 /**
  * 文章新闻
  *
  */
 function index()
 {
     $model = D('Article');
     switch (true) {
         case isset($_REQUEST['id']):
             //单独文章
             $list = $model->find(intval($_REQUEST['id']));
             //副标题
             if (empty($list['title2'])) {
                 $list['title2'] = $list['title'];
             }
             if (!$list) {
                 parent::_empty();
                 return;
             }
             if ($next = $model->where('pid=' . $list['pid'] . ' and id>' . $list['id'])->getField('id')) {
                 $this->next = U('Article/' . $next);
             }
             if ($prev = $model->where('pid=' . $list['pid'] . ' and id<' . $list['id'])->getField('id')) {
                 $this->prev = U('Article/' . $prev);
             }
             if ($list['pid']) {
                 $this->nav = get_cate_nav($list['pid']);
             }
             $this->pagetitle = $list['title'];
             $this->pagekeywords = $list['keywords'];
             $this->pagedesc = $list['description'];
             $this->assign($list);
             $this->display('Article');
             break;
         case isset($_REQUEST['pid']):
             //文章列表
             $map['pid'] = intval($_REQUEST['pid']);
             $model->_list($this->view, $map, 'id', false);
             $model = D('Article_cate');
             //seo
             $cate = $model->where(array('id' => intval($_REQUEST['pid'])))->find();
             //副标题
             if (empty($cate['name2'])) {
                 $cate['name2'] = $cate['name'];
             }
             $this->pagetitle = $cate['name'];
             $this->pagekeywords = $cate['keywords'];
             $this->pagedesc = $cate['description'];
             $this->disp_text = $cate['name'];
             $this->display('Article_list');
             break;
         default:
             parent::_empty();
             return;
             /*default:
             		$this->disp_text="Article list";//所有列表
             		$map['title']=array('neq','底部版权');
             		$model->_list($this->view,$map,'id',false);
             		$this->display ('Home:Article_list');*/
     }
 }
예제 #2
0
 function article($aid)
 {
     parent::$Model = D('Article');
     if (is_numeric($aid)) {
         $list = parent::$Model->where($map)->find($aid);
     } else {
         $title = auto_charset($aid, 'utf-8', 'gbk');
         if (strcasecmp($title, 'sitemap') == 0) {
             $this->sitemap();
             return;
         }
         if (strcasecmp($title, 'contact-us') == 0) {
             $this->contact_us();
             return;
         }
         if (strcasecmp($title, 'FAQs') == 0) {
             $this->FAQs();
             return;
         }
         if (strcasecmp($title, 'News') == 0) {
             $this->News();
             return;
         }
         $article_cache = md5('article_' . $title);
         if (S($article_cache) == '') {
             $map['title'] = $title;
             $map['title2'] = $title;
             //自定义文章URL用
             $map['_logic'] = 'or';
             $list = parent::$Model->where($map)->find();
             //副标题
             if (empty($list['title2'])) {
                 $list['title2'] = $list['title'];
             }
             $list ? $list['title'] = str_replace("-", " ", $list['title']) : '';
             S($article_cache, $list);
         }
         if (!empty($list['href'])) {
             redirect($list['href']);
             die;
         }
         $list = S($article_cache);
     }
     if ($list) {
         $this->assign($list);
         $this->pagetitle = $list['title'];
         $this->pagekeywords = $list['keywords'];
         $this->pagedesc = $list['description'];
         $this->display("Empty:Article");
     } else {
         parent::_empty();
         return;
     }
 }
예제 #3
0
 private function _Common_Cache()
 {
     $Common_Cache = array();
     $Common_Cache['catetree'] = get_indexcate_arr();
     $Common_Cache['toptenviews'] = $this->ProModel->order("viewcount desc")->limit('0,3')->select();
     //热门类别
     self::$Model = D('Cate');
     $Common_Cache['HotClass'] = self::$Model->where("ishot=1")->order("id desc")->limit('0,5')->select();
     //首页幻灯片
     $list = get_ad_arr("flash");
     for ($row = 0; $row < count($list); $row++) {
         $flashpic[$row] = __ROOT__ . "/" . $list[$row]['img_url'];
         $flashlink[$row] = $list[$row]['link'];
         $flashremark[$row] = $list[$row]['remark'];
     }
     $Common_Cache['flashpic'] = implode("|", $flashpic);
     $Common_Cache['flashlink'] = implode("|", $flashlink);
     $Common_Cache['flashremark'] = implode("|", $flashremark);
     //是否显示幻灯片描述
     $Common_Cache['brandlist'] = get_brand_tree();
     /**
      * 广告部分
      */
     //调用方法img_url图片content文字//remark标题get_ad('leftad','img_url');
     //$Common_Cache['leftad'] = get_ad('leftad');//单个
     $Common_Cache['ads'] = get_ad_arr("img");
     //广告组
     //文章类别
     self::$Model = D('Article_cate');
     $Common_Cache['Article'] = self::$Model->select();
     self::$Model = D('Article');
     foreach ($Common_Cache['Article'] as $k => $v) {
         $Common_Cache['Article'][$v['name']] = self::$Model->where(array('pid' => $v['id'], 'status' => 1))->limit(10)->order('sort desc')->select();
     }
     $Common_Cache['News'] =& $Common_Cache['Article']['新闻中心'];
     $Common_Cache['art_sys'] =& $Common_Cache['Article']['系统文章'];
     $Common_Cache['Footer'] = GetValue('footer_content');
     $Common_Cache['footcode'] = GetValue('footcode');
     $Common_Cache['tel'] = build_url(GetValue('tel'), 'tel');
     $Common_Cache['Hotmail'] = build_url(GetValue('hotmail'), 'hotmail');
     $Common_Cache['Yahoo'] = build_url(GetValue('yahoo'), 'yahoo');
     $Common_Cache['Skype'] = build_url(GetValue('skype'), 'skype');
     $Common_Cache['Email'] = build_url(GetValue('email'), 'email');
     //产品说明
     $Common_Cache['allpro_remark'] = GetValue('allpro_remark');
     $Common_Cache['newpro_remark'] = GetValue('newpro_remark');
     $Common_Cache['hotpro_remark'] = GetValue('hotpro_remark');
     $Common_Cache['recpro_remark'] = GetValue('recpro_remark');
     $Common_Cache['spepro_remark'] = GetValue('spepro_remark');
     $Common_Cache['proinfo_remark'] = GetValue('proinfo_remark');
     $Common_Cache['cart_remark'] = GetValue('cart_remark');
     //热门搜索
     $hotsearch = GetValue('hotsearch');
     foreach (explode(',', $hotsearch) as $v) {
         $Common_Cache['hotsearch'] .= "<a href='" . U('Search/index', array('key' => $v)) . "'>" . $v . "</a>&nbsp;";
     }
     //导航
     self::$Model = D('Nav');
     $Common_Cache['nav'] = self::$Model->where('status=1')->order('sort asc')->select();
     //历史订单
     self::$Model = D('Orders');
     $Common_Cache['orders'] = self::$Model->order('id desc')->limit(10)->select();
     return $Common_Cache;
 }
예제 #4
0
 function _initialize()
 {
     parent::_initialize();
     Session::set('back', null);
 }