public function lists() { //获取地址栏参数并读取栏目缓存信息 $page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $order = !empty($_GET['order']) ? get_replace_order($_GET['order']) : 'addtime'; $list = F('_gxcms/channel'); $channel['limit'] = $list[999]['special']; //查询本类及小类共多少条数据 $where['status'] = array('eq', 1); $rs = M('special'); $count = $rs->where($where)->count('id'); //生成翻页链接参数(支持排序所以强制栏目为动态模式) C('url_html_channel', 0); if ($order != 'addtime') { $arrurl['order'] = $order; } //组合分页信息 $totalpages = ceil($count / $channel['limit']); if ($page > $totalpages) { $page = $totalpages; } $pages = '共' . $count . '篇专题 当前:' . $page . '/' . $totalpages . '页 '; $pages .= get_cms_page_css($page, $totalpages, C('web_home_pagenum'), get_show_url('special', $arrurl, 2), false); //整理栏目前台标签数组变量 $channel['order'] = $order; $channel['page'] = $page; $channel['pages'] = $pages; $channel['count'] = $count; $channel['navtitle'] = '<a href="' . C('web_path') . '">首页</a> > <span>专题列表</span>'; if ($page > 1) { $channel['webtitle'] = '专题列表-第' . $page . '页-' . C('web_name'); } else { $channel['webtitle'] = '专题列表-' . C('web_name'); } //先给bdlist标签传值后再输出模板 C('bdlist_page', $page); $this->assign($channel); $this->display('special_list'); }
function get_url_where() { $where['page'] = !empty($_GET['p']) ? intval($_GET['p']) : 1; $where['year'] = intval($_REQUEST['year']); $where['id'] = intval($_REQUEST['id']); $where['sid'] = intval($_REQUEST['sid']); $where['letter'] = htmlspecialchars($_REQUEST['letter']); $where['area'] = htmlspecialchars(urldecode(trim($_REQUEST['area']))); $where['wd'] = htmlspecialchars(urldecode(trim($_REQUEST['wd']))); $where['order'] = !empty($_GET['order']) ? get_replace_order($_GET['order']) : 'addtime'; return $where; }