1、打開(kāi)includes下 init.php 末尾處增加下列代碼——可根據(jù)實(shí)際情況,增刪里面的查詢字段。 function index_get_class_articles($cat_aid, $cat_num) { $sql = "SELECT article_id, title,open_type,cat_id,content,file_url,add_time,description FROM " .$GLOBALS['ecs']->table('article'). " WHERE cat_id = ".$cat_aid." and is_open = 1 LIMIT " . $cat_num; $res = $GLOBALS['db']->getAll($sql); $arr = array(); foreach ($res AS $idx => $row) { $arr[$idx]['id'] = $row['article_id']; $arr[$idx]['title'] = $row['title']; $arr[$idx]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ?sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title']; $arr[$idx]['cat_name'] = $row['cat_name']; $arr[$idx]['content'] = $row['content']; $arr[$idx]['short_content'] = sub_str($row['content'],33); $arr[$idx]['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']); $arr[$idx]['url'] = $row['open_type'] != 1 ?build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']); $arr[$idx]['cat_url'] = build_uri('article_cat', array('acid' => $row['cat_id'])); $arr[$idx]['file_url'] = trim($row['file_url']); //圖片路徑 $arr[$idx]['description'] = $row['description']; $arr[$idx]['short_description'] = sub_str($row['description'],15); } return $arr; } 2、在調(diào)用該文章的頁(yè)面添加代碼 assign('articles',index_get_class_articles(14, 6)); ?>