腊肉太肥 發表於 2012-5-21 10:35:26

PHPCMS V9采集地址中有相对路径的问题及解决方法

修改数据库v9_collection_node,增加两个字段replace_from,replace_to(varchar(200)) <br />1、 /phpcms/modules/collection/templates/node_form.tpl.php第99行后增加(位置在&lt;/table&gt;&lt;/fieldset&gt;之前) <br />&lt;tr&gt; <br />&lt;td width=&quot;120&quot;&gt;网址替换:&lt;/td&gt; <br />&lt;td&gt; <br />&lt;input type=&quot;text&quot; name=&quot;data&quot; style=&quot;width:250px&quot; value=&quot;&lt;?php if(isset($data['replace_from'])) echo $data['replace_from']?&gt;&quot;/&gt;替换为 <br />&lt;input type=&quot;text&quot; name=&quot;data&quot; style=&quot;width:250px&quot; value=&quot;&lt;?php if(isset($data['replace_to'])) echo $data['replace_to']?&gt;&quot;/&gt; <br />&lt;/td&gt; <br />&lt;/tr&gt; <br />2、 /phpcms/modules/collection/classes/collection.class.php第177行后增加(位置在:$html = str_replace(array(&quot;&lt;/a&gt;&quot;, &quot;&lt;/A&gt;&quot;), &quot;&lt;/a&gt; &quot;, $html);之后) <br />if(!empty($config['replace_from'])){ <br />$html = str_replace($config['replace_from'], $config['replace_to'], $html);} <br />3、 进入数据库给 数据库名_collection_node 增加字段:replace_from 和 replace_to 两个字段。字数50-100都可以。 <br />然后在采集管理中我们能看到有替换网址的选项啦。将多余的../之类的替换掉就行了。
頁: [1]
查看完整版本: PHPCMS V9采集地址中有相对路径的问题及解决方法