phpcms生成的静态页目录规则是按照url规则生成的, 静态页 内容是ob_clean前台模板文件产生的phpcms\templates\default,静态页的调试 :修改静态页,重新生成静态页再看效果,也可以调用前台控制/index.php?m=openservice&c=index&a=openservice修改好前台模板再生成。只要是静态页的链接都要及时同步文件,防止死链接,数据错误

1.
$urlrule = $site_info['domain'].'/webgame/index.html~'.$site_info['domain'].'/webgame/page_{$page}.html';
2.
define('urlrule', $site_info['domain'].'/webgame/{$webgamedir}/index.html~'.$site_info['domain'].'/webgame/{$webgamedir}/spec_{$page}.html');
$globals['url_array'] = array('webgamedir'=>$filename);
后台生成静态页的类phpcms\modules\*\classes\html.class.php,在后台控制器中调用

/**
* 生成开服首页
*/
public function create_index() {
$html = pc_base::load_app_class('html');
$size = $html->create_list();
showmessage(l('index_create_finish',array('size'=>sizecount($size))));
}
$html = pc_base::load_app_class('html', 'content'); 调用content下的html.class.php
array_shift递归调用批量生成静态页

/**
* 生成静态文件
* @param string $file 文件路径
* @return boolen/intval 成功返回生成文件的大小
*/
private function create_html($file) {
$data = ob_get_contents();
ob_end_clean();
pc_base::load_sys_func('dir');
dir_create(dirname($file));
$strlen = file_put_contents($file, $data);
@chmod($file, 0777);
return $strlen;
}
* 生成列表页
public function create_list() {
$siteid = get_siteid();
//分站时计算路径
if ($siteid>1) {
$site_info = $this->site->get_by_id($siteid);
$file = pc_base::load_config('system', 'html_root').'/'.$site_info['dirname'].'/openservice/index.html';
} else {
$file = pc_base::load_config('system', 'html_root').'/openservice/index.html';
}
$this->queue->add_queue('add', $file, $siteid);
$file = phpcms_path.$file;
ob_start();
include template('openservice', 'index');
return $this->create_html($file);
}
//生成专题首页控制中心
public function public_create_html() {
$specials = getcache('create_specials', 'commons');
if (is_array($specials) && !empty($specials)) {
$specialid = array_shift($specials);
setcache('create_specials', $specials, 'commons');
$this->create_index($specialid);
delcache('create_specials', 'commons');
showmessage(l('update_special_success'), '?m=special&c=special&a=init');
//生成某专题首页
private function create_index($specialid) {
$info = $this->db->get_one(array('id'=>$specialid));
$html = pc_base::load_app_class('html');
$html->_index($specialid);
showmessage($info['title'].l('update_success'), '?m=special&c=special&a=public_create_html');
最近发现网站的生成的网页根目录太深了,就简单了编写了一个生成url规则到
扩展 > url规则管理 > 增加规则
首先添加一个栏目/列表页url生成规则
第二步:再添加一个内容页url生成规则
最后一步:在栏目管理里面进行html生成管理
在内容管理—栏目管理,点开相差的栏目具体设置那里,赫然看到html设置 。这才豁然开朗。仿佛是曲径通幽处了,官方为了把不同的栏目可以设置为不同的模式,分别设 置为静态或动态网页,所以,把设置的方法直接细化到了栏目管理里边去了。而不是统一的全局设置。跟上程序员的设计思路,这才是最重要的事
下面我们以一个实例来讲解phpcms v9 栏目的添加和设置相关内容。实例:向phpcms v9 默认栏目 国内 下面添加子栏目 军事新闻 和 政治新闻
说明:如果管理栏目页没有默认栏目,请于管理界面右上角更新缓存。
接下来填写栏目名称和目录,以及设置生成html设置选项,如下图所示:
栏目模版的选择设置,如下图所示:
关于phpcms v9 栏目设置的seo和收费设置比较简单,就不再介绍,下面介绍一下,栏目权限设置,如下图所示:
说明: 此处的配置设置菜单下,管理员设置->角色设置 相对应。
栏目添加完以后,最后不要忘记更新栏目缓存,否则会引起一些未知错误,如下图所示:
说明:单网页和外部链接 ,基本和添加普通栏目是一样的设置。在这里就不再介绍。