建站软件 优化软件 编程软件 网页辅助 站群程序 网站程序 图像处理 资源教程 字体下载 推荐软件


您的位置:首页 > 建站必知 > phpcms使用采集功能解决相对路径问题

phpcms使用采集功能解决相对路径问题

时间:2015-07-03 09:35:58  来源:免费模板网 作者:风雪 阅读次数 tagsphpcms采集

采集这个功能不建议大家使用,这样增加网络垃圾。有时候因为需求需要用这个功能怎么办呢

修改数据库v9_collection_node,增加两个字段replace_from,replace_to(varchar(200)) 

1、 /phpcms/modules/collection/templates/node_form.tpl.php第99行后增加(位置在</table></fieldset>之前) 
<tr> 
<td width="120">网址替换:</td> 
<td> 
<input type="text" name="data[replace_from]" style="width:250px" value="<?php if(isset($data['replace_from'])) echo $data['replace_from']?>"/>替换为 
<input type="text" name="data[replace_to]" style="width:250px" value="<?php if(isset($data['replace_to'])) echo $data['replace_to']?>"/> 
</td> 
</tr> 
2、 /phpcms/modules/collection/classes/collection.class.php第177行后增加(位置在:$html = str_replace(array("</a>", "</A>"), "</a> ", $html);之后) 
if(!empty($config['replace_from'])){ 
$html = str_replace($config['replace_from'], $config['replace_to'], $html);} 
3、 进入数据库给 数据库名_collection_node 增加字段:replace_from 和 replace_to 两个字段。字数50-100都可以。 
然后在采集管理中我们能看到有替换网址的选项啦。将多余的../之类的替换掉就行了。

本文地址:https://www.freemoban.com/jzbz/2015/0703/2267.html

猜你喜欢
栏目推荐
模板推荐

Copyright:www.freemoban.com 免费模板网 All Rights Reserved 网站备案:辽ICP备19014872号-2   辽公网安备 21010602000376号  辽公网安备:42900402000182号

免责声明:本站部分资源来自互联网收集,版权归原创者所有,如果侵犯了你的权益,我们会及时删除侵权内容,联系QQ:1615187561 谢谢合作!