Esempio n. 1
0
File: home.php Progetto: ilei/blog
 public function cate($mark = '', $offset = 0)
 {
     if (!$mark) {
         redirect(site_url('qq'));
     }
     $this->load->model('QQCates');
     $cate = $this->QQCates->query(array(array('status' => 1, 'cate_mark' => trim($mark))));
     $cate_id = isset($cate['0']) ? $cate[0]['id'] : 0;
     if (!$cate_id) {
         redirect(site_url('qq'));
     }
     $this->qq_title[] = "{$cate[0]['cate_name']}-{$cate[0]['cate_name']}大全";
     $this->qq_meta_keywords[] = "{$cate[0]['cate_name']},{$cate[0]['cate_name']}大全,最新{$cate[0]['cate_name']}";
     $this->qq_meta_desc[] = "2015最新最全{$cate[0]['cate_name']}";
     $this->css[] = 'style';
     $key = 'qqmark::cate::' . $cate[0]['cate_mark'] . '::' . $offset;
     $total = 'qqmark::cate::' . $cate[0]['cate_mark'] . '::total';
     if (!($sign = $this->memcached->get($key)) || !($num = $this->memcached->get($total))) {
         $num = $this->QQSign->count(array(array('status' => 1, 'cate_id' => $cate_id)));
         $sign = $this->QQSign->query(array(array('status' => 1, 'cate_id' => $cate_id)), intval($offset), 20, array('updated_time' => 'desc'));
         $this->memcached->set($key, $sign, 24 * 3600);
         $this->memcached->set($total, $num, 24 * 3600);
     }
     $assign['list'] = $sign;
     $assign['pager'] = ci_pager(site_url('list/' . $mark), $num, 20, 3, '', site_url('list/' . $mark));
     $assign['cate_name'] = $cate[0]['cate_name'];
     $this->show('home/list', $assign);
 }
Esempio n. 2
0
 public function lists($pinyin = '', $offset = 0)
 {
     $this->title[] = '首页';
     $data = $condition = array();
     $condition[] = array('status' => 1);
     $this->load->model('MCategory');
     $cate = $this->MCategory->getBy('pinyin', trim($pinyin));
     if ($cate) {
         $condition[]['cate_id'] = intval($cate[0]['id']);
     }
     $key = 'article::lists::_cate_' . $pinyin . 'offset_' . $offset;
     $key_total = 'article::lists::_cate_' . $pinyin . 'total';
     if (true || !($list = $this->memcached->get($key)) || !($total = $this->memcached->get($key_total))) {
         $list = $this->MArticle->query($condition, intval($offset), 10, array('updated_time' => 'desc'));
         $total = $this->MArticle->count($condition);
         $this->memcached->set($key, $list, 24 * 3600);
         $this->memcached->set($key_total, $total, 24 * 3600);
     }
     $data['pager'] = ci_pager(site_url('article/list/0'), $total, 10, 4, '', site_url());
     $data['list'] = $list ? $list : array();
     $data['total'] = $total;
     $data['pinyin'] = $pinyin ? $pinyin : 'home';
     $this->display('front/article/index', $data);
 }