欧美日韩精品在线,国内精品久久久久久久久,一级毛片恃级毛片直播,清纯唯美亚洲综合欧美色

DedeCMS采集教程:過(guò)濾替換的技巧_DedeCms教程

編輯Tag賺U幣
教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!
DedeCMS采集教程:過(guò)濾替換的技巧
根據(jù)我個(gè)人織夢(mèng)dedecms采集過(guò)程總結(jié)了一些經(jīng)驗(yàn),寫(xiě)出來(lái)供大家參考。
  1.采集去除鏈接
  1. [Copy to clipboard]CODE: 
  2.    
  3.   {dede:trim}]*)>([^<]*){/dede:trim} 
  4.    
  5.   -------------------------------- 
  6.    
  7.   讓field:title 標(biāo)題突破30這個(gè)長(zhǎng)度,修改代碼的方法 
  8.    
  9.   找到./include/inc_arcpart_view.php 
  10.    
  11.   行291 : 
  12.    
  13.   if($titlelen=="") $titlelen = 30
  14.    
  15.   修改為 
  16.    
  17.   if($titlelen=="") $titlelen = 60
  18.    
  19.   就可以了,然后,你可以這樣調(diào)用了 
  20.    
  21.   {dede:channelArtlist typeid='0' col=1 tablewidth='100%'
  22.    
  23.   {dede:arclist row="10"
  24.    
  25.   [field:title function="cn_substr('@me',38)" /] 
  26.    
  27.   {/dede:arclist} 
  28.    
  29.   {/dede:channelArtlist} 
  30.    
  31.   把這個(gè)延伸一下:關(guān)于inc_arcpart_view.php 
  32.    
  33.   function GetArcList($typeid=0,$row=10,$col=1,$titlelen=30,$infolen=160
  34.    
  35.   $imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$keyword=""
  36.    
  37.   $innertext="",$tablewidth="100",$arcid=0,$idlist=""
  這里的參數(shù)都可以更改你實(shí)際需要的模板元素尺寸大小.
  
  2. 采集過(guò)慮中去掉鏈接保留文字的方法!
  
  柏老大的方法是{dede:trim}<a ([^>]*)>([^<]*)</a>{/dede:trim}
  
  這樣做會(huì)去掉<a hf.......>與</a>之間的字符!這樣整個(gè)文章就少了部分字符,不完整了!
  
  后來(lái)我多次測(cè)試,總算找到了正確的使用方法!如下:
  1. {dede:trim}<a([^>]*)>{/dede:trim} 
  2.   
  3.  {dede:trim}</a>{/dede:trim} 
  4.   
  5.  做成兩條采集規(guī)則就可以了! 
  6.   
  7.  在實(shí)際使用中好像([^<]*)([^>]*)兩條一起使用才行! 
  3. 過(guò)濾div
  1. {dede:trim}]*)>{/dede:trim} 
  2.   
  3.  {dede:trim} 
  4.   
  5.  {/dede:trim} 
  6.   
  7.  過(guò)濾js 
  8.   
  9.  {dede:trim}]*)>([^<]*){/dede:trim} 
  10.   
  11.  過(guò)濾未知變量字符 
  12.   
  13.  固定(.*)固定  
  4.dede萬(wàn)能過(guò)濾代碼
  
  以下是常用的正則表達(dá)式標(biāo)簽
  1. {dede:trim}<tbody(.*)>{/dede:trim} 
  2.   
  3.  {dede:trim}</tbody>{/dede:trim} 
  4.   
  5.  {dede:trim}<table(.*)>{/dede:trim} 
  6.   
  7.  {dede:trim}</table>{/dede:trim} 
  8.   
  9.  {dede:trim}<tr(.*)>{/dede:trim} 
  10.   
  11.  {dede:trim}</tr>{/dede:trim} 
  12.   
  13.  {dede:trim}<td(.*)>{/dede:trim} 
  14.   
  15.  {dede:trim}</td>{/dede:trim} 
  16.   
  17.  {dede:trim}<font(.*)>{/dede:trim} 
  18.   
  19.  {dede:trim}</font>{/dede:trim} 
  20.   
  21.  {dede:trim}<a(.*)>{/dede:trim} 
  22.   
  23.  {dede:trim}</a>{/dede:trim} 
  24.   
  25.  {dede:trim}<param(.*)>{/dede:trim} 
  26.   
  27.  {dede:trim}<embed(.*)</embed>{/dede:trim} 
  28.   
  29.  {dede:trim}<object(.*)</object>{/dede:trim} 
  30.   
  31.  {dede:trim}<iframe(.*)</iframe>{/dede:trim} 
  32.   
  33.  {dede:trim}<form(.*)</form>{/dede:trim} 
  34.   
  35.  {dede:trim}<input(.*)>{/dede:trim} 
  36.   
  37.  {dede:trim}<script(.*)</script>{/dede:trim} 
  38.   
  39.  {dede:trim}<style(.*)</style>{/dede:trim} 
  40.   
  41.  {dede:trim}<!--(.*)-->{/dede:trim} 
  42.   
  43.  以下為不常用的正則表達(dá)式標(biāo)簽 
  44.   
  45.  {dede:trim}<div(.*)>{/dede:trim} 
  46.   
  47.  {dede:trim}</div>{/dede:trim} 
  48.   
  49.  {dede:trim}<center(.*)>{/dede:trim} 
  50.   
  51.  {dede:trim}</center>{/dede:trim} 
  52.   
  53.  {dede:trim}<p(.*)>{/dede:trim} 
  54.   
  55.  {dede:trim}</p>{/dede:trim} 
  56.   
  57.  {dede:trim}<span(.*)>{dede:trim} 
  58.   
  59.  {dede:trim}</span>{dede:trim} 
  60.   
  61.  {dede:trim}<img(.*)>{/dede:trim} 
以上內(nèi)容僅供大家學(xué)習(xí)參考,希望對(duì)你有所幫助。  
 

查看更多 DedeCms教程  織夢(mèng)模板  織夢(mèng)DedeCms視頻教程  織夢(mèng)dedecms專(zhuān)題

來(lái)源:模板無(wú)憂(yōu)//所屬分類(lèi):DedeCms教程/更新時(shí)間:2020-05-30
相關(guān)DedeCms教程

DedeCms教程教程Rss訂閱Cms教程搜索