【phpcms-v9】phpcms-v9中栏目页的静态化生成

http://blog.csdn.net/yanhui_wei/article/details/8286578

一、phpcms-v9中栏目页的静态化生成在phpcms/modules/content/create_html.php控制器中的category()方法


有时候我们不希望某些特定的栏目生成静态页,这时候我们该怎么办呢?为了测试方便,复制category(),并命名为categorysub()方法

 1 /**
 2     * 生成子分类的栏目页
 3     */
 4     public function categorysub() {
 5        
 6         if(isset($_POST['dosubmit'])) {
 7        
 8             extract($_POST,EXTR_SKIP);
 9             $this->html = pc_base::load_app_class('html');
10             $referer = isset($referer) ? urlencode($referer) : '';
11 
12             $modelid = intval($_POST['modelid']);
13             if(!isset($set_catid)) {
14                             
15                 if($catids[0] != 0) {//指定栏目的情况
16                     $update_url_catids = $catids;
17                                  
18                 } else {//不限栏目的情况
19                     foreach($this->categorys as $catid=>$cat) {
20                         if($cat['siteid'] != $this->siteid || $cat['type']==2 || !$cat['ishtml']) continue;
21                         if($modelid && ($modelid != $cat['modelid'])) continue;
22                         //位彦辉:不想生成栏目静态页的栏目可以在这里做控制if($catid!=13 && $catid != 9){...}
23                         //栏目id为1、9、10,11、13、14的栏目不生成栏目静态页
24                         if(!in_array($catid,array(1,9,10,11,13,14))){
25                             $update_url_catids[] = $catid;
26                         }
27                         //$update_url_catids[] = $catid;
28                                                 
29                     }
30                 }
31                                 
32                 setcache('update_html_catid'.'-'.$this->siteid.'-'.$_SESSION['userid'],$update_url_catids,'content');
33                 $message = L('start_update_category');
34                 $forward = "?m=content&c=create_html&a=categorysub&set_catid=1&pagesize=$pagesize&dosubmit=1&modelid=$modelid&referer=$referer";
35             
36                 showmessage($message,$forward);
37             }
原文地址:https://www.cnblogs.com/gzmg/p/3224719.html