POST TIME:2018-10-30 21:31
對于主站和論壇分隔2地的,大家一般首頁調用論壇都是JS來搞是吧,下面推薦一個好方法實現html調用,對搜索引擎友好。
論壇以PW舉例:
一般實現方法:
<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>
對搜索引擎很不友好,不能抓取,而且萬一論壇掛了,搞的主站也很慢。
修正方法:
{dede:huataixiangqi runphp=’yes’}
@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′);
{/dede:huataixiangqi}
ok了,是不是很簡單啊。
嘿嘿。
注:此方法最好只用在首頁,如果在內容也也這樣搞,可能生成html很慢
修改論壇new.php:
本來讀取論壇的數據是js數據:
document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=57787′ target=’_blank’>iPhone玩家不愿外傳的smart壁紙</a> <br>");
document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=56837′ target=’_blank’>iphone2.0以上固件下載,這些資源都是對大 ..</a> <br>");
document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=54915′ target=’_blank’>白蘋果問題解決辦法以及原因簡單分析 方法 ..</a> <br>");
document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=54502′ target=’_blank’>各平臺建立iphone 開發環境的方法</a> <br>");
document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=54058′ target=’_blank’>如何解決刪除SummberBoard后變白蘋果的問題</a> <br>");
document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=53664′ target=’_blank’>iphone棋牌類游戲匯總!愛牌的瘋友別錯過 ..</a> <br>");
document.write("<li> <a href=’http://bbs.***.com.cn/read.php?tid=53623′ target=’_blank’>iPhone內置鈴聲全下載</a> <br>");
現在不需要js數據,要的是html數據,所以大家需要把論壇new.php里的輸出語句中的document.write去掉。
其他程序舉例:
{dede:book runphp=’yes’}
@me = file_get_contents(‘http://book.myiphones.com.cn/freelist/new.html’);
{/dede:book}
拿來就用,數據讀取端格式要對就OK