DedeCMS采集教程:過(guò)濾替換的技巧_DedeCms教程
教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!
DedeCMS采集教程:過(guò)濾替換的技巧
根據(jù)我個(gè)人織夢(mèng)dedecms采集過(guò)程總結(jié)了一些經(jīng)驗(yàn),寫(xiě)出來(lái)供大家參考。
根據(jù)我個(gè)人織夢(mèng)dedecms采集過(guò)程總結(jié)了一些經(jīng)驗(yàn),寫(xiě)出來(lái)供大家參考。
1.采集去除鏈接
- [Copy to clipboard]CODE:
- {dede:trim}]*)>([^<]*){/dede:trim}
- --------------------------------
- 讓field:title 標(biāo)題突破30這個(gè)長(zhǎng)度,修改代碼的方法
- 找到./include/inc_arcpart_view.php
- 行291 :
- if($titlelen=="") $titlelen = 30;
- 修改為
- if($titlelen=="") $titlelen = 60;
- 就可以了,然后,你可以這樣調(diào)用了
- {dede:channelArtlist typeid='0' col=1 tablewidth='100%'}
- {dede:arclist row="10"}
- [field:title function="cn_substr('@me',38)" /]
- {/dede:arclist}
- {/dede:channelArtlist}
- 把這個(gè)延伸一下:關(guān)于inc_arcpart_view.php
- function GetArcList($typeid=0,$row=10,$col=1,$titlelen=30,$infolen=160,
- $imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$keyword="",
- $innertext="",$tablewidth="100",$arcid=0,$idlist="")
這里的參數(shù)都可以更改你實(shí)際需要的模板元素尺寸大小.
2. 采集過(guò)慮中去掉鏈接保留文字的方法!
柏老大的方法是{dede:trim}<a ([^>]*)>([^<]*)</a>{/dede:trim}
這樣做會(huì)去掉<a hf.......>與</a>之間的字符!這樣整個(gè)文章就少了部分字符,不完整了!
后來(lái)我多次測(cè)試,總算找到了正確的使用方法!如下:
- {dede:trim}<a([^>]*)>{/dede:trim}
- {dede:trim}</a>{/dede:trim}
- 做成兩條采集規(guī)則就可以了!
- 在實(shí)際使用中好像([^<]*)([^>]*)兩條一起使用才行!
3. 過(guò)濾div
- {dede:trim}]*)>{/dede:trim}
- {dede:trim}
- {/dede:trim}
- 過(guò)濾js
- {dede:trim}]*)>([^<]*){/dede:trim}
- 過(guò)濾未知變量字符
- 固定(.*)固定
4.dede萬(wàn)能過(guò)濾代碼
以下是常用的正則表達(dá)式標(biāo)簽
- {dede:trim}<tbody(.*)>{/dede:trim}
- {dede:trim}</tbody>{/dede:trim}
- {dede:trim}<table(.*)>{/dede:trim}
- {dede:trim}</table>{/dede:trim}
- {dede:trim}<tr(.*)>{/dede:trim}
- {dede:trim}</tr>{/dede:trim}
- {dede:trim}<td(.*)>{/dede:trim}
- {dede:trim}</td>{/dede:trim}
- {dede:trim}<font(.*)>{/dede:trim}
- {dede:trim}</font>{/dede:trim}
- {dede:trim}<a(.*)>{/dede:trim}
- {dede:trim}</a>{/dede:trim}
- {dede:trim}<param(.*)>{/dede:trim}
- {dede:trim}<embed(.*)</embed>{/dede:trim}
- {dede:trim}<object(.*)</object>{/dede:trim}
- {dede:trim}<iframe(.*)</iframe>{/dede:trim}
- {dede:trim}<form(.*)</form>{/dede:trim}
- {dede:trim}<input(.*)>{/dede:trim}
- {dede:trim}<script(.*)</script>{/dede:trim}
- {dede:trim}<style(.*)</style>{/dede:trim}
- {dede:trim}<!--(.*)-->{/dede:trim}
- 以下為不常用的正則表達(dá)式標(biāo)簽
- {dede:trim}<div(.*)>{/dede:trim}
- {dede:trim}</div>{/dede:trim}
- {dede:trim}<center(.*)>{/dede:trim}
- {dede:trim}</center>{/dede:trim}
- {dede:trim}<p(.*)>{/dede:trim}
- {dede:trim}</p>{/dede:trim}
- {dede:trim}<span(.*)>{dede:trim}
- {dede:trim}</span>{dede:trim}
- {dede:trim}<img(.*)>{/dede:trim}
以上內(nèi)容僅供大家學(xué)習(xí)參考,希望對(duì)你有所幫助。
查看更多 DedeCms教程 織夢(mèng)模板 織夢(mèng)DedeCms視頻教程 織夢(mèng)dedecms專(zhuān)題
相關(guān)DedeCms教程:
- DedeCMS系統(tǒng)參數(shù)設(shè)置手冊(cè)之互動(dòng)設(shè)置 相關(guān)案例演示
- 織夢(mèng)dedeCMS文章防刷新機(jī)制的代碼
- 織夢(mèng)CMS實(shí)現(xiàn)軟件及分類(lèi)信息采集的方法
- 如何實(shí)現(xiàn)織夢(mèng)dedecms會(huì)員登陸后就不顯示廣告
- 搜索框里顯示字段鼠標(biāo)點(diǎn)擊后就隱藏的方法
- dedecms下廣告延時(shí)加載顯示,大大提高網(wǎng)頁(yè)訪(fǎng)問(wèn)的速度
- DEDECMS復(fù)制文章帶本站鏈接代碼實(shí)例
- 織夢(mèng)(dedecms)優(yōu)化之更改RSS、sitemap路徑至根目錄
- 織夢(mèng)DEDECMS5.7相關(guān)文章的調(diào)用問(wèn)題
- 織夢(mèng)刪掉會(huì)員空間,保留開(kāi)放會(huì)員(禁止注冊(cè))的方法
- 織夢(mèng)dedecms channelartlist下autoindex失效解決辦法
- Dedecms 自定義表單提交后自動(dòng)發(fā)送表單數(shù)據(jù)到指定郵箱的思路
DedeCms教程教程Rss訂閱Cms教程搜索
DedeCms教程推薦
猜你也喜歡看這些
- 織夢(mèng)企業(yè)網(wǎng)站模板 適合工業(yè)相關(guān)的集團(tuán)網(wǎng)站
- 織夢(mèng)DEDECMS美容院模板/掛號(hào)/婦產(chǎn)科醫(yī)院織夢(mèng)模板
- dedecms床上用品-家具床墊企業(yè)網(wǎng)站模板(自適應(yīng))
- dedecms大氣藍(lán)色通用企業(yè)模板
- dedecms綠色家具模板-布局清晰大方
- DEDE織夢(mèng)CMS電子商務(wù)公司簡(jiǎn)潔紅色企業(yè)網(wǎng)站模板
- dede會(huì)員試聽(tīng)收費(fèi)試聽(tīng)音頻在線(xiàn)試聽(tīng)網(wǎng)站織夢(mèng)模板
- 織夢(mèng)dede企業(yè)公司行業(yè)網(wǎng)站模板(帶手機(jī)版)數(shù)據(jù)同步
- 響應(yīng)式智能電子設(shè)備無(wú)人機(jī)類(lèi)網(wǎng)站織夢(mèng)模板
- 織夢(mèng)CMS國(guó)際貨運(yùn)物流公司HTML5 自適應(yīng)網(wǎng)站模板
- 相關(guān)鏈接:
復(fù)制本頁(yè)鏈接| 搜索DedeCMS采集教程:過(guò)濾替換的技巧| DedeCms模板| Dede模板| 織夢(mèng)模板| dedecms
- 教程說(shuō)明:
DedeCms教程-DedeCMS采集教程:過(guò)濾替換的技巧。