时间:2016-02-16 19:28 来源: 我爱IT技术网 作者:佚名
欢迎您访问我爱IT技术网,今天小编为你分享的电脑教程之dedeCMS系列教程:【百度新闻协议 关于图片显示的问题】,请阅读以下详细内容!
百度新闻协议 关于图片显示的问题
关键字描述:显示 问题 图片 关于 新闻 协议 百度   " <图片:
图片:
[attachment=16890] [attachment=16890] [attachment=16890] <?phprequire_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 );
关键字描述:显示 问题 图片 关于 新闻 协议 百度   " <
$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 的时候,有图片的(包括有缩略图)都无法把地址显示出来
关于百度新闻协议 关于图片显示的问题的用户互动如下:
相关问题:
答: >>详细
相关问题:
答: >>详细
相关问题:
答: >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
