is_number($_REQUEST['u']) ? $_REQUEST['u'] : false; $sql = "SELECT company,site_logo FROM " . $dou->table('admin') . " WHERE user_id = '$uid'"; $query = $dou->query($sql); $about = $dou->fetch_array($query); if(!is_array($about)||empty($uid)){ $dou->dou_msg('请不要做非法操作!', ''); exit; } $nav_middle_list = $dou->gets_nav('middle', '0', 'article_category', $cat_id, $cate_info['parent_id'],$uid,'nav'); foreach ($nav_middle_list as $key => $value) { //print_r($value[module].$key.'
'); if($value[module] == "article_category"){ $nav_middle_list[$key][cur] = '1'; } } // 验证并获取合法的ID,如果不合法将其设定为-1 $cat_id = $firewall->get_legal_id('article_category', $_REQUEST['id'], $_REQUEST['unique_id']); if ($cat_id == -1) { $dou->dou_msg($GLOBALS['_LANG']['page_wrong'], ROOT_URL); } else { $where = ' WHERE user_id = '.$uid.' && cat_id IN (' . $cat_id . $dou->dou_child_id('article_category', $cat_id) . ')'; //$where = ' WHERE cat_id IN (' . $cat_id . $dou->dou_child_id('article_category', $cat_id) . ')'; } // 获取分页信息 $page = $check->is_number($_REQUEST['page']) ? trim($_REQUEST['page']) : 1; $limit = $dou->pager('article', ($_DISPLAY['article'] ? $_DISPLAY['article'] : 10), $page, $dou->rewrites_url('article_category', $cat_id,$uid,'nav',$page), $where); /* 获取文章列表 */ $sql = "SELECT id, title, content, image, cat_id, add_time, click, description FROM " . $dou->table('article') . $where . " ORDER BY id DESC" . $limit; $query = $dou->query($sql); while ($row = $dou->fetch_array($query)) { $url = $dou->rewrites_url('article', $row['id'], $uid,'nav');//原 $dou->rewrite_url('article', $row['id']); $add_time = date("Y-m-d", $row['add_time']); $add_time_short = date("m-d", $row['add_time']); $image = $row['image'] ? ROOT_URL . $row['image'] : ''; // 如果描述不存在则自动从详细介绍中截取 $description = $row['description'] ? $row['description'] : $dou->dou_substr($row['content'], 200); $article_list[] = array ( "id" => $row['id'], "cat_id" => $row['cat_id'], "title" => $row['title'], "image" => $image, "add_time" => $add_time, "add_time_short" => $add_time_short, "click" => $row['click'], "description" => $description, "url" => $url ); } // 获取分类信息 $sql = "SELECT cat_id, cat_name, parent_id FROM " . $dou->table('article_category') . " WHERE cat_id = '$cat_id'"; $query = $dou->query($sql); $cate_info = $dou->fetch_array($query); $smarty->assign('company', $about['company']);//logo名称 $smarty->assign('site_logo', $about['site_logo']);//logo图片 $smarty->assign('site_url',$dou->get_nav_index($uid));//会员首页地址 // 赋值给模板-meta和title信息 $smarty->assign('page_title', $dou->page_title('article_category', $cat_id).$about['company'].'--'.$dou->page_title()); $smarty->assign('keywords', $cate_info['keywords']); $smarty->assign('description', $cate_info['description']); // 赋值给模板-导航栏 $smarty->assign('nav_top_list', $dou->get_nav('top')); $smarty->assign('nav_middle_list', $nav_middle_list);//$dou->gets_nav('middle', '0', 'article_category', $cat_id, $cate_info['parent_id'],$uid,'nav') //$smarty->assign('nav_bottom_list', $dou->get_nav('bottom')); // 赋值给模板-数据 $smarty->assign('ur_here', $dou->ur_here('article_category', $cat_id,'', $uid,'nav')); $smarty->assign('cate_info', $cate_info); $smarty->assign('article_category', $dou->get_category('article_category', 0, $cat_id, $uid, 'nav')); $smarty->assign('article_list', $article_list); $smarty->display('article_category.tpl'); ?>