演示链接:查看演示

dede不使用js调用非DEDE数据 如论坛等其他cms数据

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

 

THE END
喜欢就支持一下吧
点赞0 分享