一、phpcms-v9中欄目頁的靜態化生成在phpcms/modules/content/create_html.php控制器中的category()方法.
有時候我們不希望某些特定的欄目生成靜態頁,這時候我們該怎么辦呢?為了測試方便,復制category(),并命名為categorysub()方法.
- /**
- * 生成子分類的欄目頁
- */
- public function categorysub() {
- if(isset($_POST['dosubmit'])) {
- extract($_POST,EXTR_SKIP);
- $this->html = pc_base::load_app_class('html');
- $referer = isset($referer) ? urlencode($referer) : '';
- $modelid = intval($_POST['modelid']);
- if(!isset($set_catid)) {
- //開源軟件:Vevb.com
- if($catids[0] != 0) {//指定欄目的情況
- $update_url_catids = $catids;
- } else {//不限欄目的情況
- foreach($this->categorys as $catid=>$cat) {
- if($cat['siteid'] != $this->siteid || $cat['type']==2 || !$cat['ishtml']) continue;
- if($modelid && ($modelid != $cat['modelid'])) continue;
- //不想生成欄目靜態頁的欄目可以在這里做控制if($catid!=13 && $catid != 9){...}
- //欄目id為1、9、10,11、13、14的欄目不生成欄目靜態頁
- if(!in_array($catid,array(1,9,10,11,13,14))){
- $update_url_catids[] = $catid;
- }
- //$update_url_catids[] = $catid;
- }
- }
- setcache('update_html_catid'.'-'.$this->siteid.'-'.$_SESSION['userid'],$update_url_catids,'content');
- $message = L('start_update_category');
- $forward = "?m=content&c=create_html&a=categorysub&set_catid=1&pagesize=$pagesize&dosubmit=1&modelid=$modelid&referer=$referer";
- showmessage($message,$forward);
- }
新聞熱點
疑難解答