dede不使用js調(diào)用非DEDE數(shù)據(jù) 如論壇等其他cms數(shù)據(jù)_DedeCms教程

      編輯Tag賺U幣
      教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!
      對(duì)于織夢(mèng)dedecms主站和論壇分隔2地的,大家一般首頁(yè)調(diào)用論壇都是JS來(lái)搞是吧,下面推薦一個(gè)好方法實(shí)現(xiàn)html調(diào)用,對(duì)搜索引擎友好。
       
      論壇以PW舉例:
      一般實(shí)現(xiàn)方法:
      1. <script src="http://bbs.myiphones.com.cn/new.php?action=article&digest=1&postdate=0&author=0&fname=0&hits=0&replies=0&pre=0&num=7&length=40&order=2"></script> 
      對(duì)搜索引擎很不友好,不能抓取,而且萬(wàn)一論壇掛了,搞的主站也很慢。
      修正方法:
      1. {dede:huataixiangqi runphp=’yes’}  
      2. @me = file_get_contents(‘http://bbs.*****.com.cn/new.php?action=article&pre=1&num=10&length=50&order=2&fidin=15&digest=0&postdate=0&author=0&fname=0&hits=0&replies=0′);  
      3. {/dede:huataixiangqi} 
      ok了,是不是很簡(jiǎn)單啊。
       
      注:此方法最好只用在首頁(yè),如果在內(nèi)容也也這樣搞,可能生成html很慢 
      修改論壇new.php:
      本來(lái)讀取論壇的數(shù)據(jù)是js數(shù)據(jù):
      1. document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=57787′ target=’_blank’>iPhone玩家不愿外傳的smart壁紙</a> <br>");  
      2. document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=56837′ target=’_blank’>iphone2.0以上固件下載,這些資源都是對(duì)大 ..</a> <br>");  
      3. document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=54915′ target=’_blank’>白蘋果問(wèn)題解決辦法以及原因簡(jiǎn)單分析 方法 ..</a> <br>");  
      4. document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=54502′ target=’_blank’>各平臺(tái)建立iphone 開發(fā)環(huán)境的方法</a> <br>");  
      5. document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=54058′ target=’_blank’>如何解決刪除SummberBoard后變白蘋果的問(wèn)題</a> <br>");  
      6. document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=53664′ target=’_blank’>iphone棋牌類游戲匯總!愛牌的瘋友別錯(cuò)過(guò) ..</a> <br>");  
      7. document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=53623′ target=’_blank’>iPhone內(nèi)置鈴聲全下載</a> <br>"); 
      現(xiàn)在不需要js數(shù)據(jù),要的是html數(shù)據(jù),所以大家需要把論壇new.php里的輸出語(yǔ)句中的document.write去掉。
       
      其他程序舉例:
      1. {dede:book runphp=’yes’}  
      2. @me = file_get_contents(‘http://book.myiphones.com.cn/freelist/new.html’);  
      3. {/dede:book} 
      拿來(lái)就用,數(shù)據(jù)讀取端格式要對(duì)就OK

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

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

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