一、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);
- }
新闻热点
疑难解答