帝国cms采集过滤与替换的技巧(图文教程)
<p>主要介绍帝国cms采集过滤与替换,还有些技巧。</p><p>一、过滤<br />1、帝国cms采集过滤分为两种:<br />(1)“整体页面过滤正则”:<br /><img style="max-width:100%!important;height:auto!important;"alt="1-1-1.JPG" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145S2b0.jpg" /><br /><br />(2)“过滤广告正则”:<br /><img style="max-width:100%!important;height:auto!important;"alt="1-1-2.JPG" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145S2303.jpg" /><br /><br />我们有些疑惑,这两种过滤到底有什么区别?“整体页面过滤正则”是过滤整个网页的html代码。“过滤广告正则”是过滤文章内容,仅对文章内容([!--newstext--])起作用。<br /><br />2、过滤实例:<br />过滤实例(1):<br /><img style="max-width:100%!important;height:auto!important;"alt="1-2-1.jpg" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145S2445.jpg" /><br /><br />我们采集后发现信息内容底部多了行代码:“</p>
<div style="clear:both; height:0; overflow:hidden; visibility:hiddden"></div>
<p>”,根据格式“广告开始[!--ad--]广告结束”得到“过滤广告正则<br />”:<br /><img style="max-width:100%!important;height:auto!important;"alt="1-2-2.JPG" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145S3A5.jpg" /><br /><br />过滤实例(2):<br /><img style="max-width:100%!important;height:auto!important;"alt="1-2-3.jpg" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145S3946.jpg" /><br /><br />要过滤链接代码怎么办,注意“过滤广告正则”右边有堆代码:<br /><br />鼠标先点击A,系统自动生成过滤链接代码“,,,”,这样就可以把采集后的内容链接过滤掉了。同理,如果想过滤其他html代码就点击相应的标签代码。<br />注意事项:当内容分页包含在内容([!--newstext--])里时,要过滤掉内容分页,否则会重复出现内容分页。</p>
<p></p>
<p>二、替换<br />1、帝国cms采集替换也分为两种:<br />(1)“整体页面替换”:<br /><img style="max-width:100%!important;height:auto!important;"alt="2-1-1.JPG" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145S5b9.jpg" /><br /><br />(2)“替换”:<br /><img style="max-width:100%!important;height:auto!important;"alt="2-1-2.JPG" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145S5241.jpg" /><br /><br />他们两种区别:“整体页面替换”是替换整个网页的html代码。“替换”是替换文章标题和内容,仅对标题([!--title--])和([!--newstext--])起作用。<br /><br />2、替换实例:<br /><img style="max-width:100%!important;height:auto!important;"alt="2-1-3.JPG" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145SC91.jpg" /><br />我们要把内容里的“新华网”替换成“中华网”:<br /><br />预览下:<br /><img style="max-width:100%!important;height:auto!important;"alt="2-1-5.jpg" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145SMR.jpg" /><br />没有问题,替换过来了。</p>
<p>三、图片采集<br />(1)我们采集时会碰到信息内容可以正常采集,但是里面的图片却不显示,例子:<br /><img style="max-width:100%!important;height:auto!important;"alt="3-1.jpg" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145SIL.jpg" /><br /><br />信息内容可以正常采集,就是图片不显示出来,这是由于内容图片的路径不对,图片的路径为相对地址。<br /><br />(2)查看源代码:<br /><img style="max-width:100%!important;height:auto!important;"alt="3-2.jpg" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145SS14.jpg" /><br />图片是相对地址,要换成绝对地址才能采集成功。<br /><br />(3)替换成绝对地址:<br />先在目标站的图片右键查看属性:<br /><img style="max-width:100%!important;height:auto!important;"alt="3-3-1.jpg" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145SYb.jpg" /><br />目标站的图片地址为“http://www.gdyd.com/news/PNews/a/e77366_634655073936250000.jpg”,我们采集所到的图片地址为“/news/PNews/a/e77366_634655073936250000.jpg”,分析得到前缀“http://www.gdyd.com”,我们把前缀放到“图片/FLASH地址前缀(内容)”,如下图:<br /><img style="max-width:100%!important;height:auto!important;"alt="3-3-2.JPG" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145S9447.jpg" /><br /><br />(4)前台预览图片:<br />图片显示出来了:<br /><img style="max-width:100%!important;height:auto!important;"alt="3-4-1.JPG" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145Sc02.jpg" /><br /><br />查看源代码:<br /><img style="max-width:100%!important;height:auto!important;"alt="3-4-2.JPG" src="https://zhuji.jb51.net/uploads/allimg/20250616/1-250616145S9425.jpg" /><br />图片地址没错,是本地地址。<br />注意事项:我们在采集预览和在本地临时入库信息时,发现已经添加了图片地址前缀了,但是图片还是不显示,出现这个你不用理他,直接入库,入库了系统才会自动添加图片地址前缀。</p>
<p>至此采集实例讲解完毕,这三讲对帝国cms采集的基本流程,重点,难点基本都概括了,还有些基础的功能没能一一介绍清楚,大家可以到帝国官方网站看下基础教程。</p>
<p></p>
頁:
[1]