public function index() { $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME); if (!$GLOBALS['tmpl']->is_cached('faq_index.html', $cache_id)) { $faq_list = array(); $faq_group_list = $GLOBALS['db']->getAll("select distinct(`group`) from " . DB_PREFIX . "faq order by sort asc"); foreach ($faq_group_list as $k => $v) { $faq_list[$v['group']] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "faq where `group`='" . $v['group'] . "' order by sort asc"); } $GLOBALS['tmpl']->assign("faq_list", $faq_list); $GLOBALS['tmpl']->assign("page_title", "常见问题"); } //获得文章列表 $artilce_cate = load_auto_cache("article_cates"); foreach ($artilce_cate as $k => $v) { $artilce_cate[$k]['cate_id'] = $v['id']; $artilce_cate[$k]['titles'] = $v['title']; if ($id > 0 && $v['id'] == $id) { $type_id = intval($v['type_id']); $cate_name = $v['title']; } if ($id == $artilce_cate[$k]['cate_id']) { $artilce_cate[$k]['current'] = 1; } } $GLOBALS['tmpl']->assign("artilce_cate", $artilce_cate); //文章头部导航 $nav_top = set_nav_top($GLOBALS['module'], $GLOBALS['action']); $GLOBALS['tmpl']->assign('nav_top', $nav_top); $GLOBALS['tmpl']->assign('deal_type', 'article_type'); $GLOBALS['tmpl']->display("faq_index.html", $cache_id); }
public function show() { //获得文章列表 $artilce_cate = load_auto_cache("article_cates"); foreach ($artilce_cate as $k => $v) { $artilce_cate[$k]['cate_id'] = $v['id']; $artilce_cate[$k]['titles'] = $v['title']; if ($id > 0 && $v['id'] == $id) { $type_id = intval($v['type_id']); $cate_name = $v['title']; } if ($id == $artilce_cate[$k]['cate_id']) { $artilce_cate[$k]['current'] = 1; } } $GLOBALS['tmpl']->assign("artilce_cate", $artilce_cate); //文章头部导航 $nav_top = set_nav_top($GLOBALS['module'], $GLOBALS['action']); $GLOBALS['tmpl']->assign('nav_top', $nav_top); $GLOBALS['tmpl']->assign('deal_type', 'article_type'); $act = strim($_REQUEST['act']); $help_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "help where type = '" . $act . "' or id = " . intval($act)); $GLOBALS['tmpl']->assign("help_item", $help_item); $GLOBALS['tmpl']->assign("page_title", $help_item['title']); $GLOBALS['tmpl']->display("help_show.html"); }
public function index() { $GLOBALS['tmpl']->caching = true; //输出文章 $id = intval($_REQUEST['id']); $article = $GLOBALS['db']->getRow("select a.*,ac.type_id from " . DB_PREFIX . "article as a left join " . DB_PREFIX . "article_cate as ac on ac.id=a.cate_id where a.id={$id}"); //$article_shang 上一篇文章,$article_xia下一篇文章 $article_shang = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "article where id<" . $article['id'] . " and is_delete=0 and is_effect=1 order by id desc limit 0,1"); $article_xia = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "article where id>" . $article['id'] . " and is_delete=0 and is_effect=1 order by id desc limit 0,1"); if ($article_shang['rel_url'] == "") { $article_shang['url'] = url('article', array('id' => $article_shang['id'])); } else { $article_shang['url'] = $article_shang['rel_url']; } if ($article_xia['rel_url'] == "") { $article_xia['url'] = url('article', array('id' => $article_xia['id'])); } else { $article_xia['url'] = $article_xia['rel_url']; } $cate_id = $article['cate_id']; $article['tags_arr'] = preg_split("/[ ,]/", $article['tags']); $artilce_cate = load_auto_cache("article_cates"); $artilce_cate_new = array(); foreach ($artilce_cate as $k => $v) { if ($v['type_id'] == $article['type_id'] && $v['id'] != $cate_id && $v['num'] > 0) { $artilce_cate_new[$k]['cate_id'] = $v['id']; $artilce_cate_new[$k]['titles'] = $v['title']; $artilce_cate_new[$k]['url'] = url('article_cate', array('id' => $v['id'])); } } $GLOBALS['tmpl']->assign("other_cate", $artilce_cate_new); //文章详细页面最新更新(控制最新的10条) $temp_article_list = $GLOBALS['db']->getAllCached("SELECT a.*,c.type_id from " . DB_PREFIX . "article a LEFT JOIN " . DB_PREFIX . "article_cate c on a.cate_id=c.id where 1=1 and a.is_delete=0 and a.is_effect=1 and c.type_id=" . $article['type_id'] . " and a.cate_id={$cate_id} and a.id!={$id} order by update_time desc limit 0,5"); $article_list = array(); foreach ($temp_article_list as $k => $v) { //最新更新 $article_list[$k]['cate_title'] = $v['title']; if ($v['rel_url'] == "") { $article_list[$k]['url'] = url('article', array('id' => $v['id'])); } else { $article_list[$k]['url'] = $v['rel_url']; } } unset($temp_article_list); $GLOBALS['tmpl']->assign('deal_type', 'article_type'); //文章头部导航 $nav_top = set_nav_top($GLOBALS['module'], $GLOBALS['action'], $id); $GLOBALS['tmpl']->assign('nav_top', $nav_top); $GLOBALS['tmpl']->assign("page_title", $article['seo_title']); $GLOBALS['tmpl']->assign("page_seo_keyword", $article['seo_keyword']); $GLOBALS['tmpl']->assign("page_seo_description", $article['seo_description']); $GLOBALS['tmpl']->assign("article", $article); $GLOBALS['tmpl']->assign("article_shang", $article_shang); $GLOBALS['tmpl']->assign("article_xia", $article_xia); $GLOBALS['tmpl']->assign("article_list", $article_list); $GLOBALS['tmpl']->display("article_index.html"); }
public function index() { $id = intval($_REQUEST['id']); if (!$id && isset($_REQUEST['bs'])) { $bs = strim($_REQUEST['bs']); $id = $GLOBALS['article_cates_bs'][$bs]; } $GLOBALS['tmpl']->assign("page_title", "文章列表"); $GLOBALS['tmpl']->caching = true; $artilce_cate = load_auto_cache("article_cates"); $type_id = 0; $cate_name = ''; $tag = strim($_REQUEST['tag']); //标签 foreach ($artilce_cate as $k => $v) { $artilce_cate[$k]['cate_id'] = $v['id']; $artilce_cate[$k]['titles'] = $v['title']; if ($id > 0 && $v['id'] == $id) { $type_id = intval($v['type_id']); $cate_name = $v['title']; } if ($id == $artilce_cate[$k]['cate_id']) { $artilce_cate[$k]['current'] = 1; } } $GLOBALS['tmpl']->assign("cate_name", $cate_name); $GLOBALS['tmpl']->assign("artilce_cate", $artilce_cate); //分页 $page_size = DEALUPDATE_PAGE_SIZE; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; //条件判断 $where = '1=1 and a.is_delete=0 and a.is_effect=1 and c.is_effect=1'; if ($id > 0) { $where .= ' and c.type_id=' . $type_id . ' and a.cate_id=' . $id; } else { $where .= ' and c.type_id=0 '; } if ($tag != "") { $where .= " and (a.content like '%" . $tag . "%' or a.title like '%" . $tag . "%')"; } $temp_artilce_list = $GLOBALS['db']->getAllCached("SELECT a.*,c.type_id,c.title as cate_name from " . DB_PREFIX . "article a LEFT JOIN " . DB_PREFIX . "article_cate c on a.cate_id=c.id where {$where} order by a.sort desc,a.update_time desc limit {$limit}"); $temp_artilce_count = $GLOBALS['db']->getOne("select COUNT(a.id) from " . DB_PREFIX . "article a LEFT JOIN " . DB_PREFIX . "article_cate c on a.cate_id=c.id WHERE " . $where . ""); $hot_article = array(); $week_article = array(); $artilce_item = array(); foreach ($temp_artilce_list as $k => $v) { //最新智能头条type_id==0普通文章, type_id==1帮助文章,is_hot==1热门,is_week==1本周必读 if ($v['id'] > 0) { $artilce_item[$k]['cate_title'] = $v['title']; $artilce_item[$k]['seo_keyword'] = $v['seo_keyword']; $artilce_item[$k]['title'] = $v['title']; $artilce_item[$k]['content'] = $v['content']; $artilce_item[$k]['update_time'] = $v['update_time']; $artilce_item[$k]['brief'] = $v['brief']; $artilce_item[$k]['cate_name'] = $v['cate_name']; $artilce_item[$k]['writer'] = $v['writer']; $artilce_item[$k]['icon'] = $v['icon']; $artilce_item[$k]['tags_arr'] = preg_split("/[ ,]/", $v['tags']); $artilce_item[$k]['cate_url'] = url('article_cate', array('id' => $v['cate_id'])); if ($v['rel_url'] == "") { $artilce_item[$k]['url'] = url('article#index', array('id' => $v['id'])); } else { $artilce_item[$k]['url'] = $v['rel_url']; } } } if ($id > 0) { $artilce_count = $GLOBALS['db']->getOne("select COUNT(*) from " . DB_PREFIX . "article where is_delete=0 and is_effect=1 and cate_id =" . $id); } else { $artilce_count = $temp_artilce_count; } $page = new Page(intval($artilce_count), $page_size); //初始化分页对象 //$p = $page->show(); $p = $page->article_cate_show($id); $GLOBALS['tmpl']->assign('pages', $p); //如果发布人为空,默认网站发布 $site_name = app_conf("SITE_NAME"); $GLOBALS['tmpl']->assign("site_nam", $site_name); //文章头部导航 $nav_top = set_nav_top($GLOBALS['module'], $GLOBALS['action'], $id); $GLOBALS['tmpl']->assign('nav_top', $nav_top); $GLOBALS['tmpl']->assign("id", $id); $GLOBALS['tmpl']->assign("artilce_list", $artilce_item); $GLOBALS['tmpl']->assign('deal_type', 'article_type'); $GLOBALS['tmpl']->display("article_cate.html"); }
public function index() { $id = intval($_REQUEST['id']); $GLOBALS['tmpl']->assign("page_title", "文章列表"); //改写 $g_links = get_link_by_id(14); $GLOBALS['tmpl']->assign("g_links", $g_links); $GLOBALS['tmpl']->caching = true; $artilce_cate = load_auto_cache("article_cates"); $type_id = 0; $cate_name = ''; foreach ($artilce_cate as $k => $v) { $artilce_cate[$k]['cate_id'] = $v['id']; $artilce_cate[$k]['titles'] = $v['title']; if ($id > 0 && $v['id'] == $id) { $type_id = intval($v['type_id']); $cate_name = $v['title']; } if ($id == $artilce_cate[$k]['cate_id']) { $artilce_cate[$k]['current'] = 1; } } $GLOBALS['tmpl']->assign("cate_name", $cate_name); $GLOBALS['tmpl']->assign("artilce_cate", $artilce_cate); //分页 $page_size = DEALUPDATE_PAGE_SIZE; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; //条件判断 $where = '1=1 and a.is_delete=0 and a.is_effect=1 '; if ($id > 0) { $where .= ' and c.type_id=' . $type_id . ' and a.cate_id=' . $id; } else { $where .= ' and c.type_id=0 '; } $temp_artilce_list = $GLOBALS['db']->getAllCached("SELECT a.*,c.type_id,c.title as cate_name from " . DB_PREFIX . "article a LEFT JOIN " . DB_PREFIX . "article_cate c on a.cate_id=c.id where {$where} order by a.update_time desc limit {$limit}"); $temp_artilce_count = $GLOBALS['db']->getOne("select COUNT(*) from " . DB_PREFIX . "article a," . DB_PREFIX . "article_cate c WHERE a.cate_id=c.id and a.is_delete=0 AND a.is_effect=1 and c.type_id=0"); $hot_article = array(); $week_article = array(); $artilce_item = array(); foreach ($temp_artilce_list as $k => $v) { //最新智能头条type_id==0普通文章, type_id==1帮助文章,is_hot==1热门,is_week==1本周必读 if ($v['id'] > 0) { $artilce_item[$k]['cate_title'] = $v['title']; $artilce_item[$k]['seo_keyword'] = $v['seo_keyword']; $artilce_item[$k]['title'] = $v['title']; $artilce_item[$k]['content'] = $v['content']; $artilce_item[$k]['update_time'] = $v['update_time']; $artilce_item[$k]['cate_name'] = $v['cate_name']; $artilce_item[$k]['cate_url'] = url('article_cate', array('id' => $v['cate_id'])); if ($v['rel_url'] == "") { $artilce_item[$k]['url'] = url('article', array('id' => $v['id'])); } else { $artilce_item[$k]['url'] = $v['rel_url']; } } } $page = new Page(intval($temp_artilce_count), $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); unset($temp_artilce_list); //文章头部导航 $nav_top = set_nav_top($GLOBALS['module'], $GLOBALS['action'], $id); $GLOBALS['tmpl']->assign('nav_top', $nav_top); $GLOBALS['tmpl']->assign("id", $id); $GLOBALS['tmpl']->assign("artilce_list", $artilce_item); $GLOBALS['tmpl']->assign('deal_type', 'article_type'); $GLOBALS['tmpl']->display("article_cate.html"); }