phpcms多站点用二级目录作为站点域名,内容页生成的路径不对,都是默认了用第一个站点的域名(原文地址:http://blog.csdn.net/u014617119/article/details/53588819)http://bbs.phpcms.cn/thread-728701-1-1.htmlh ...
phpcms多站点用二级目录作为站点域名,内容页生成的路径不对,都是默认了用第一个站点的域名
(原文地址:http://blog.csdn.net/u014617119/article/details/53588819)
http://bbs.phpcms.cn/thread-728701-1-1.html
http://bbs.phpcms.cn/thread-669461-1-1.html
http://bbs.phpcms.cn/forum.php?mod=viewthread&tid=270400&highlight=%D5%BE%C8%BA
以上都是百度找到解决方法,和我的解决方法不一样,我也说说自己的;
我的解决方法很简单,首先找到 phpcms/modules/content/class/url.class.php 这个文件;
找到第一个函数function __construct()
原:
- public function __construct() {
- $this->urlrules = getcache('urlrules','commons');
- self::set_siteid();
- $this->categorys = getcache('category_content_'.$this->siteid,'commons');
- $this->html_root = pc_base::load_config('system','html_root');
-
- }
-
-
-
-
- 修改成:
-
- public function __construct() {
- $this->urlrules = getcache('urlrules','commons');
- self::set_siteid();
- $this->categorys = getcache('category_content_'.$this->siteid,'commons');
- $this->html_root = pc_base::load_config('system','html_root');
- $this->sitelist = getcache('sitelist','commons');
-
- }
然后找找到 function show($id, $page = 0, $catid = 0, $time = 0, $prefix = '',$data = '',$action = 'edit',$upgrade = 0)这个函数
原:
- if($content_ishtml && $url) {
- if ($domain_dir && $category['isdomain']) {
- $url_arr[1] = $html_root.'/'.$domain_dir.$urls;
- $url_arr[0] = $url.$urls;
- } else {
- $url_arr[1] = $html_root.'/'.$urls;
- $url_arr[0] = WEB_PATH == '/' ? $match_url.$html_root.'/'.$urls : $match_url.rtrim(WEB_PATH,'/').$html_root.'/'.$urls;
- }
- } elseif($content_ishtml) {
- $url_arr[0] = WEB_PATH == '/' ? $html_root.'/'.$urls : rtrim(WEB_PATH,'/').$html_root.'/'.$urls;
- $url_arr[1] = $html_root.'/'.$urls;
- } else {
- $url_arr[0] = $url_arr[1] = APP_PATH.$urls;
- }
修改成:
- if($content_ishtml && $url) {
-
- if ($domain_dir && $category['isdomain']) {
-
- $url_arr[1] = $html_root.'/'.$domain_dir.$urls;
- $url_arr[0] = $url.$urls;
- } else {
-
-
- $sitedomain=rtrim($this->sitelist[$this->siteid]['domain'],'/');
- $url_arr[1] = $html_root.'/'.$urls;
- $url_arr[0] = WEB_PATH == '/' ? $sitedomain.$html_root.'/'.$urls : $sitedomain.$html_root.'/'.$urls;
-
-
- }
- } elseif($content_ishtml) {
-
- $url_arr[0] = WEB_PATH == '/' ? $html_root.'/'.$urls : rtrim(WEB_PATH,'/').$html_root.'/'.$urls;
- $url_arr[1] = $html_root.'/'.$urls;
- } else {
- $url_arr[0] = $url_arr[1] = APP_PATH.$urls;
- }
这样就可以了,然后在重新生成一次静态,先更新url再更新栏目页;
http://www.jingyanzhinan.cn/article-1034-1.html以上内容就是关于【phpcms多站点用二级目录作为站点域名,内容页生成的路径不对,都是默认了用第一个站点 ... 】的指南经验分享;您也可以通过下方的评论互动,发表您的意见和观点,让更多人通过生活指南经验分享因之受益,让生活变得更简单。