对于织梦dedecms主站和论坛分隔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

免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。