百度新闻协议 关于图片显示的问题

所属分类: CMS教程 / dedecms 阅读数: 1775
收藏 0 赞 0 分享
关键字描述:显示 问题 图片 关于 新闻 协议 百度   " <

图片:
图片:
[attachment=16890] [attachment=16890] [attachment=16890] <?php
require_once(dirname(__FILE__)."/config.php");
if(empty($do)){
include './templets/baidunews.htm';
}else{
$baidunews = "<?xml version=\"1.0\" encoding=\"gb18030\" ?>\n";
$baidunews .= "<document>\n";
$baidunews .= "<webSite>$cfg_webname </webSite>\n";
$baidunews .= "<webMaster>$cfg_adminemail </webMaster>\n";
$baidunews .= "<updatePeri>$cfg_updateperi </updatePeri>\n";
$limit = $cfg_baidunews_limit;
if($limit > 100 || $limit < 1) $limit = 100;
$query = "select maintable.*, addtable.body, arctype.typename, arc.writer,arc.source
from [url=mailto:xkzzz_full_search]xkzzz_full_search[/url] maintable
left join [url=mailto:xkzzz_addonarticle]xkzzz_addonarticle[/url] addtable on addtable.aid=maintable.aid
left join [url=mailto:xkzzz_arctype]xkzzz_arctype[/url] arctype on arctype.ID=maintable.typeid
left join [url=mailto:xkzzz_archives]xkzzz_archives[/url] arc on arc.ID=maintable.aid
where maintable.channelid=1 order by maintable.uptime desc limit $limit
";
$dsql->SetQuery($query);
$dsql->execute();
while($row = $dsql->getarray()){
$title = htmlspecialchars($row['title']);

if(strpos($row['url'],'http://') === false){
$link = $cfg_basehost.$row['url'];
}else{
$link = $row['url'];
}
$link = htmlspecialchars($link);
$description = htmlspecialchars($row['addinfos']);
$description =str_replace("  ","", $description);//去除中文tab键产生的空白
$text = trim($row['body']);
//处理内容块;
$text =nl2br($text );
$text =strip_tags($text );
$text =str_replace("  ","", $text);
$text =str_replace("<","<", $text);
$text =str_replace(">",">", $text);
$text =str_replace("—","-", $text);
$text = preg_replace("/\ \;/i", " ", $text );
#p# 关键字描述:显示 问题 图片 关于 新闻 协议 百度   " <


$text =preg_replace("/\&hellip\;/i","",$text );
$text =str_replace(" >",">", $text);
$text =str_replace("“","'", $text);
$text =str_replace("”","'", $text);
$text = htmlspecialchars($text );
$text =preg_replace ("/(\s )/", " ", $text );
$text =preg_replace("/[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]/",'',$text );
//处理内容块结束;
$image = '';
$headlineimg = '';
$keywords = htmlspecialchars($row['keywords']);
$category = htmlspecialchars($row['typename']);
$author = htmlspecialchars($row['writer']);
$source = htmlspecialchars($row['source']);
$pubdate = htmlspecialchars(gmdate('Y-m-d H:i',$row['pubdate'] $cfg_cli_time * 3600));
$baidunews .= "<item>\n";
$baidunews .= "<title>$title </title>\n";
$baidunews .= "<link>$link </link>\n";
$baidunews .= "<description>$description </description>\n";
$baidunews .= "<text>$text </text>\n";
$baidunews .= "<image>$image </image>\n";
$baidunews .= "<headlineImg />\n";
$baidunews .= "<keywords>$keywords </keywords>\n";
$baidunews .= "<category>$category </category>\n";
$baidunews .= "<author>$author </author>\n";
$baidunews .= "<source>$source </source>\n";
$baidunews .= "<pubDate>$pubdate </pubDate>\n";
$baidunews .= "</item>\n";

}
$baidunews .= "</document>\n";
$fp = fopen(dirname(__FILE__).'/'.$filename,'w');
fwrite($fp,$baidunews);
fclose($fp);
showmsg("<a href='{$filename}' target=\"_blank\">{$filename}生成成功</a>",'javascript:;');
}

此内容是在坛子里的一位朋友发的.完全OK,但是生成xml 的时候,有图片的(包括有缩略图)都无法把地址显示出来
更多精彩内容其他人还在看

DedeCMS 5 .7 自定义表单制作和调用办法[图文]

在很多建站需求中,需要一些额外的表单供前台用户提交,以便于收集、统计、分析及处理更多的数据,比如:在线订单、在线报名等一些常见的互动应用
收藏 0 赞 0 分享

dedecms 添加字段后软件列表页无法调用软件大小问题的解决方法

最近做模版想在软件列表页(list_soft.htm)利用[field:softsize/]调用软件大小,才发现原来需要如果解决方法
收藏 0 赞 0 分享

织梦DedeCMS模板防盗的四种方法分享

织梦(DedeCMS)模板也是一种财富,不想自己辛辛苦苦做的模板被盗用,在互联网上出现一些和自己一模一样的网站,就需要做好模板防盗
收藏 0 赞 0 分享

dedecms TAG标签按栏目显示的方法

想让dedecms 的TAG标签按栏目显示
收藏 0 赞 0 分享

dedecms修改按tag标签显示全站相关内容的方法

本文简单的设置就可以把dedecms按tag标签显示全站相关内容
收藏 0 赞 0 分享

dedecms正文自动排版插件 伪原创站必备

为了节约时间,站长可以安装dedecms正文自动排版插件,通过该插件,所有的隐藏代码、链接代码、垃圾代码可以一并删除,统一文章格式,方便简单
收藏 0 赞 0 分享

织梦dedecms 提示 body has not allow words 问题解决

body has not allow words DEDE提示这个是什么意思呢
收藏 0 赞 0 分享

dedecms修改文章自动增加的起始ID从指定数字增加文章ID的方法

dedecms织梦文章系统修改文章自动增加的起始ID从指定数字增加文章ID的方法教给大家
收藏 0 赞 0 分享

dedecms V5.7修改表前缀的方法及出现不显示文章内容的解决方法

将下面的内容保存为 pre.bat 内容可以使用记事本批量替换成你的表前缀和想要改成的前缀. window下的ren命令是重命名的
收藏 0 赞 0 分享

织梦 DeDeCMS 添加自定义属性的方法(图文教程)

由于想在网站首页添加一个本站原创内容的版块.又没办法通过版块id来调用,把每篇原创文章添加副栏目又非常麻烦
收藏 0 赞 0 分享
查看更多