phpcms v9二级栏目生成到根目录后三级栏目无法访问的解决办法
这个栏目问题折腾了我一天多,可怜我这个美工又不会程序!!!
我的问题是:
我的栏目设置如下:
一级栏目[生成到根目录(是)]> 二级栏目[生成到根目录(是)] > 三级栏目[生成到根目录(否)]
这样出现的问题是:
页面文件生成的路径是mysite/一级栏目/二级栏目/三级栏目/index.html;
但实际上页面生成的url地址是mysite/二级栏目/三级栏目/index.html;
2个地址不一致,导致我的三级栏目不能访问。
首先我看到数据库里面arrparentid和url路径前面居然不一样,难怪打不开了。
然后我就到处找生成parentdir和url字段的方法。
可怜我不会程序啊,几乎花了我一天的时间找,昨天晚上终于被我找着了。
分别是在\phpcms\modules\admin\category.php中的get_parentdir方法
和\phpcms\modules\content\classes\url.class.php中的get_categorydir方法。
经比较这2段程序明显不一样,明显是2个程序员写的。
写category.php页面的程序员我就不多评价了……唉,只能说考虑不周吧。
我从数据库里面看到url字段里的路径都是对的,而parentdir里的路径是错误的。
我就参照url.class.php里面的写法把category.php里的get_parentdir方法改了下。
这个改也花了我今天一天的时间唉,中间我向这个问,那个问,都无果。
只好自己慢慢磨了,程序里面判断都好懂,就是被数组啊,和程序里面的这个this那个this搞的头都晕了,还好以前有点asp的基础。
后来倒是被我琢磨出来了,顺利生成页面,搞定。
这是我改过的地方,给遇到同样问题的人参考参考,改后暂时没发现什么问题。
转:http://www.ratuo.com/websitezt/experience/30582.html
栏目设置成三级栏目,二级设置为生成到根目录后三级生成html路径错误的解决方法:
将phpcms/models/admin/category.php的get_parentdir方法中
if (strpos($url, '://')===false) {
if ($setting['creat_to_html_root']) {
return '';
} else {
$arrparentid = explode(',', $arrparentid);
$arrcatdir = array();
foreach($arrparentid as $id) {
if($id==0) continue;
$arrcatdir[] = $this->categorys[$id]['catdir'];
}
return implode('/', $arrcatdir).'/';
}
}
替换成:
if (strpos($url, '://')===false) {
if ($setting['creat_to_html_root']) {
return '';
} else {
$arrparentid = explode(',', $arrparentid);
$arrcatdir = array();
foreach($arrparentid as $id) {
if($id==0) continue;
if($this->categorys[$id]['sethtml']==0 && $this->categorys[$id]['type']!=1) continue;
$arrcatdir[] = $this->categorys[$id]['catdir'];
}
if($arrcatdir)
{
return implode('/', $arrcatdir).'/';
}else{
return '';
}
}
}
转:http://bbs.phpcms.cn/thread-271429-2-1.html
最新文章
- nginx rewrite 实现二级域名跳转
- gb2312
- python学习之——eclipse+pydev 环境搭建
- 数据库开发基础-SQl Server 变量、运算符、if、while
- MONO加载DLL调试命令
- CSS3-html,样式与样式表的创建,选择器
- 解决Odoo日期(时间)无效的问题 [转]
- js的变量作用域 ,变量提升
- 给UITextField左侧加一个小图标
- Linux系统编程(22)——响应信号
- 关于Java和.NET之间的通信问题(JSON)
- 15. 使用Apache Curator管理ZooKeeper
- pyspider安装提示:got an unexpected keyword argument 'io_loop'的解决办法
- NodeJs连接操作MongoDB数据库
- 机器学习---感知机(Machine Learning Perceptron)
- Babel插件:@babel/plugin-transform-runtime
- 解决centos 7.5安装openvpn,mirrors.163.com提示没有可用软件包openvpn、easy-rsa问题
- CentOS配置通过DHCP的方式动态获取IP
- ubuntu16.04安装nvidia ,cuda(待完善)
- Win2012&;Win2008双系统启动菜单设置
热门文章
- 探索 ConcurrentHashMap 高并发性的实现机制--转
- Invalidate、RedrawWindow与UpdateWindow
- java中关于json传图片的方法
- Jquery解析Json字符串,并且动态生成数据表格Table
- 沈逸老师PHP魔鬼特训笔记(2)
- Jsonp post 跨域方案
- hdu 4417 划分树
- 关于Merge的整理--AndroidScreenSlidePager开源库中用到的
- [算法练习] UVA-10010-Where's Waldorf?
- Java Concurrency - Lock