public function lists() { $mid = intval($_GET['mid']); $did = intval($_GET['did']); $page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $limit = intval(C('user_page_cm')); $order = C('db_prefix') . 'comment.addtime desc'; $join = C('db_prefix') . 'user on ' . C('db_prefix') . 'comment.uid = ' . C('db_prefix') . 'user.id'; $field = C('db_prefix') . 'comment.*,' . C('db_prefix') . 'user.id as userid,' . C('db_prefix') . 'user.username,' . C('db_prefix') . 'user.face'; $where[C('db_prefix') . 'comment.did'] = array('eq', $did); $where[C('db_prefix') . 'comment.mid'] = array('eq', $mid); if (C('user_check')) { $where[C('db_prefix') . 'comment.status'] = array('eq', 1); } $rs = M('comment'); $count = $rs->field($field)->where($where)->count('id'); $totalpages = ceil($count / $limit); // $list = $rs->field($field)->where($where)->join($join)->order($order)->limit($limit)->page($page)->select(); foreach ($list as $key => $val) { $list[$key]['floor'] = $count - (($page - 1) * $limit + $key); } //分页链接参数 $pageurl = 'javascript:void(0)" onclick="CommentShow(\'' . U('comment/lists', array('mid' => $mid, 'did' => $did, 'p' => '{!page!}'), false, false) . '\')'; $pages = '共' . $count . '条评论 当前:' . $page . '/' . $totalpages . '页 '; $pages .= get_cms_page_css($page, $totalpages, C('user_page_cm'), $pageurl, false); $this->assign('mid', $mid); $this->assign('did', $did); $this->assign('pages', $pages); $this->assign('count', $count); $this->assign('list_comment', $list); $this->display('comment'); }
public function lists() { $id = intval($_GET['id']); $page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $limit = intval(C('user_page_gb')); $order = C('db_prefix') . 'gbook.addtime desc'; $join = C('db_prefix') . 'user on ' . C('db_prefix') . 'gbook.uid = ' . C('db_prefix') . 'user.id'; $field = C('db_prefix') . 'gbook.*,' . C('db_prefix') . 'user.id as userid,' . C('db_prefix') . 'user.username,' . C('db_prefix') . 'user.face'; if (C('user_check')) { $where[C('db_prefix') . 'gbook.status'] = array('eq', 1); } $rs = M('gbook'); $count = $rs->field($field)->where($where)->count('id'); $page = get_cms_page_max($count, $limit, $page); $list = $rs->field($field)->where($where)->join($join)->order($order)->limit($limit)->page($page)->select(); //dump($rs->getLastSql()); foreach ($list as $key => $val) { $list[$key]['floor'] = $count - (($page - 1) * $limit + $key); } //强制栏目为动态模式 C('url_html_channel', 0); //分页展示信息 $totalpages = ceil($count / $limit); $pages = '共' . $count . '篇留言 当前:' . $page . '/' . $totalpages . '页 '; $pages .= get_cms_page_css($page, $totalpages, C('web_home_pagenum'), get_show_url('guestbook', '', 2), false); if ($id) { $rs = M("Video"); $arr = $rs->field('id,title')->where('status=1 and id=' . $id)->find(); if ($arr) { $this->assign('content', '影片<' . $arr['title'] . '>不能观看,请修复!'); } } $this->assign('webtitle', '留言本' . '-' . C('web_name')); $this->assign('navtitle', '<a href="' . C('web_path') . '">首页</a> > <span>留言本</span>'); $this->assign('list_guestbook', $list); $this->assign('pages', $pages); $this->assign('count', $count); $this->assign('id', $id); $this->display('guestbook'); }
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_cms_page($totalrecords, $pagesize, $currentpage, $params, $filename = '条数据', $pagego = true, $halfPer = 5) { $page['totalrecords'] = $totalrecords; //总记录数 $page['totalpages'] = ceil($page['totalrecords'] / $pagesize); //总页数 $page['currentpage'] = $currentpage; //当前页数 $page['urlpage'] = $params . '{!page!}'; $page['listpages'] = '共' . $page['totalrecords'] . $filename . ' 当前:' . $page['currentpage'] . '/' . $page['totalpages'] . '页 '; if ($pagego) { $pagego = 'jumpurl(\'' . $page['urlpage'] . '\',' . $page['totalpages'] . ')'; } $page['listpages'] .= get_cms_page_css($page['currentpage'], $page['totalpages'], $halfPer, $page['urlpage'], $pagego); return $page; }
public function search() { //获取地址栏参数并读取缓存信息 $url = get_url_where(); $list = F('_gxcms/channel'); $channel = $list[999]; //搜索条件 $where['status'] = array('eq', 1); if ($url['wd']) { $search['title'] = array('like', '%' . $url['wd'] . '%'); //$search['intro'] = array('like','%'.$url['wd'].'%'); $search['actor'] = array('like', '%' . $url['wd'] . '%'); $search['director'] = array('like', '%' . $url['wd'] . '%'); $jumpurl['wd'] = urlencode($url['wd']); } if ($url['year']) { $search['year'] = array('eq', $url['year']); $jumpurl['year'] = $url['year']; } if ($url['area']) { $search['area'] = array('eq', '.$url["area"].'); $jumpurl['area'] = urlencode($url['area']); } if ($url['letter']) { $search['letter'] = array('eq', $url['letter']); $jumpurl['letter'] = $url['letter']; } if ($url['id']) { if (get_channel_son($url['id'])) { $where['cid'] = $url['id']; } else { $where['cid'] = get_channel_sqlin($url['id']); } $jumpurl['id'] = $url['id']; } if (isset($search)) { $search['_logic'] = 'or'; $where['_complex'] = $search; } if ($url['order'] != 'addtime') { $jumpurl['order'] = $url['order']; } $rs = M('Video'); $count = $rs->where($where)->count('id'); //组合分页信息(强制为动态模式) C('url_html_channel', 0); $jumpurl['p'] = ''; $totalpages = ceil($count / $channel['video']); if ($url['page'] > $totalpages) { $url['page'] = $totalpages; } $pages = '共' . $count . '部影片 当前:' . $url['page'] . '/' . $totalpages . '页 '; $pages .= get_cms_page_css($url['page'], $totalpages, C('web_home_pagenum'), str_replace('/lists', '/search', get_show_url('video', $jumpurl, 2)), false); //前台模板变量赋值 $channel['cid'] = $url['id']; $channel['year'] = $url['year']; $channel['area'] = $url['area']; $channel['keyword'] = $url['wd']; $channel['order'] = $url['order']; $channel['letter'] = $url['letter']; $channel['count'] = $count; $channel['page'] = $url['page']; $channel['pages'] = $pages; if ($url['page'] > 1) { $channel['webtitle'] = '搜索 ' . $url['wd'] . ' 的结果列表 -第' . $url['page'] . '页-' . C('web_name'); } else { $channel['webtitle'] = '搜索 ' . $url['wd'] . ' 的结果列表 -' . C('web_name'); } $channel['navtitle'] = '<a href="' . C('web_path') . '">首页</a> > <span>搜索页</span>'; //先给bdsearch标签传值后再输出模板 C('bdsearch_page', $url['page']); C('bdsearch_where', $where); $this->assign($channel); $this->display('video_search'); }
/** * 将资源站抓取的值整理成数组变量(飞飞+光线) * * @param $array_url * @param $xml */ public function ff_gx_xml($array_url, $xml) { //组合分页信息 preg_match('<list page="([0-9]+)" pagecount="([0-9]+)" pagesize="([0-9]+)" recordcount="([0-9]+)">', $xml, $page_array); $xml_page['recordcount'] = $page_array[4]; $xml_page['pagecount'] = $page_array[2]; $xml_page['pagesize'] = $page_array[3]; $xml_page['pageindex'] = $page_array[1]; $array_url['p'] = '{!page!}'; $array_tpl['pageurl'] = U('Admin-Collect/Gxcms', $array_url); $array_tpl['pagelist'] = '共' . $xml_page['recordcount'] . '条数据 页次:' . $xml_page['pageindex'] . '/' . $xml_page['pagecount'] . '页 ' . get_cms_page_css($xml_page['pageindex'], $xml_page['pagecount'], 5, $array_tpl['pageurl'], 'pagego(\'' . $array_tpl['pageurl'] . '\',' . $xml_page['pagecount'] . ')'); //组合绑定分类 preg_match_all('/<ty id="([0-9]+)">([\\s\\S]*?)<\\/ty>/', $xml, $array_list); foreach ($array_list[1] as $key => $value) { $list[$key]['cid'] = $value; $list[$key]['cname'] = $array_list[2][$key]; $list[$key]['bind_id'] = $array_url['fid'] . '_' . $value; } //组合单个影视数据 preg_match_all('/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><dt>([\\s\\S]*?)<\\/dt><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><reurl>([\\s\\S]*?)<\\/reurl><\\/video>/', $xml, $array_vod); foreach ($array_vod[1] as $key => $value) { $vod[$key]['addtime'] = $value; $vod[$key]['id'] = $array_vod[2][$key]; $vod[$key]['iid'] = $array_vod[2][$key]; $vod[$key]['cid'] = getbindval($array_url['fid'] . '_' . $array_vod[3][$key]); $vod[$key]['title'] = htmlspecialchars_decode($array_vod[4][$key]); $vod[$key]['cname'] = $array_vod[5][$key]; $vod[$key]['picurl'] = $array_vod[7][$key]; $vod[$key]['language'] = $array_vod[8][$key]; $vod[$key]['area'] = $array_vod[9][$key]; $vod[$key]['year'] = $array_vod[10][$key]; $vod[$key]['serial'] = $array_vod[11][$key]; $vod[$key]['intro'] = htmlspecialchars_decode($array_vod[12][$key]); $vod[$key]['actor'] = htmlspecialchars_decode($array_vod[13][$key]); $vod[$key]['director'] = htmlspecialchars_decode($array_vod[14][$key]); $vod[$key]['content'] = htmlspecialchars_decode($array_vod[16][$key]); $vod[$key]['inputer'] = $array_url['fid'] . '_' . $vod[$key]['id']; $vod[$key]['reurl'] = $array_vod[17][$key]; if (!$vod[$key]['reurl']) { $vod[$key]['reurl'] = str_replace('@', '/', $array_url['reurl']) . $vod[$key]['id']; } preg_match_all('/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/', $array_vod[15][$key], $url_arr); $vod[$key]['playurl'] = htmlspecialchars_decode(implode('$$$', $url_arr[2])); } $array['url'] = $array_url; //远程URL变量 $array['tpl'] = $array_tpl; //本地模板变量 $array['page'] = $xml_page; //远程分页信息 $array['listclass'] = $list; //远程分类变量 $array['listvod'] = $vod; //远程数据变量 return $array; }
public function specialshow() { $go = intval($_GET['go']); $this->checkhtml(C('url_html_channel'), '专题栏目', '?s=Admin/Html/Maps/go/' . $go); $list = F('_gxcms/channel'); $channel['limit'] = $list[999]['special']; //查询本类及小类共多少条数据 $rs = M("Special"); $where['status'] = array('eq', 1); $count = $rs->where($where)->count('id'); //计算出该栏目需要生成的总页数 $totalpages = ceil($count / $channel['limit']); if ($totalpages < 1) { $totalpages = 1; } //准备生成 echo '<div class="htmllist" id="show" style="font-size:12px;">'; echo '<li>网站专题共需要生成<span>' . $totalpages . '</span>页</li>'; for ($ii = 1; $ii <= $totalpages; $ii++) { //当前专题分页前台标签数组变量------------------------------------------------------------------- $pageurl = get_show_url('special', array('id' => $cid), 2); $pages = '共' . $count . '篇专题 当前:' . $ii . '/' . $totalpages . '页 '; $pages .= get_cms_page_css($ii, $totalpages, 5, $pageurl, false); $channel['page'] = $ii; $channel['pages'] = $pages; $channel['count'] = $count; if ($ii > 1) { $channel['webtitle'] = '专题列表-第' . $ii . '页-' . C('web_name'); } else { $channel['webtitle'] = '专题列表-' . C('web_name'); } $channel['navtitle'] = '<a href="' . C('web_path') . '">首页</a> > <span>专题列表</span>'; //先给bdlist标签传值后再生成模板 C('bdlist_page', $page); $this->assign($channel); $listdir = str_replace('{!page!}', $ii, get_show_url_dir('special', $cid, $ii)); //保存路径 $this->buildHtml($listdir, './', 'Home:special_list'); $specialurl = C('webpath') . $listdir . C('html_file_suffix'); //预览路径 echo '<li>专题列表第<span>' . $ii . '</span>页 <a href="' . $specialurl . '" target="_blank">' . $specialurl . '</a> 操作成功</li>'; } echo '</div><script>document.getElementById("show").style.display="none";</script>'; if ($go) { $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Maps/go/' . $go); $this->success('专题列表已经生成完毕,正在准备生成网站地图,请稍等!'); } else { $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Show'); $this->success('恭喜您,专题列表页已经生成完毕!'); } }