楼主可以看下这篇文章http://www.yesky.com/136/1904636.shtml 一般的RSS文档结构:<?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0"> <channel> <title>CNN.com</title> <link>http://www.example.org</link> <description>A short description of this feed</description> <language>en</language> <pubDate>Mon,17 Oct 2005 07:56:23 EDT</pubDate> <item> <title>Catchy Title</title> <link>http://www.example.org/2005/11/catchy-title.html</link> <description>The description can hold any content you wish,including XHTML.</description> <pubDate>Mon,17 Oct 2005 07:55:28 EDT</pubDate> </item> <item> <title>Another Catchy Title</title> <link>http://www.example.org/2005/11/another-catchy-title.html</link> <description>The description can hold any content you wish,including XHTML.</description> <pubDate>Mon,17 Oct 2005 07:55:28 EDT</pubDate> </item> </channel> </rss>
现在遇到一个问题了,RSS格式我用的是13楼的。问题是如果item标签里的description标签里的内容就是文章内容,怎么把这个描述分段显示或把文章里的图片显示在这个描述中呢?例如下面代码运行在Firefox浏览器(Firefox可以把下面代码烧制出来,IE只是显示这个XML文件的内容结构),代码中description标签是我从数据库中取出的内容,但可能description标签中有p标签,所以description标签中的内容显示不出来,把description标签中的p标签删去后才可以显示,我见过别人过客烧制出来的description可以分段显示,而且上面还可以显示图片,请问怎么实现分段显示呢<rss version="2.0"> <channel> <title>CNN.com</title> <link>http://www.example.org</link> <description>A short description of this feed</description> <language>en</language> <pubDate>Mon,17 Oct 2005 07:56:23 EDT</pubDate> <item> <title>Catchy Title</title> <link>http://www.example.org/2005/11/catchy-title.html</link> <description><p>The description can hold any content you wish,including XHTML.</p><p>The description can hold any content you wish,including XHTML.</p></description> <pubDate>Mon,17 Oct 2005 07:55:28 EDT</pubDate> </item> </channel> </rss>
我这有个标准的feedcreator类文件,在资源区没上传成功,郁闷,如果你搜索不到的话,需要可以加我msn。
[email protected]
其实就象你说的就是生成xml格式进行读取,但php有现成的包,
你去下本电子书看看,具体的包叫什么名字忘了
<?xml version="1.0" encoding="gb2312" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns="http://my.netscape.com/rdf/simple/0.9/">
<channel>
<title>O-blog 2.6</title>
<link>http://localhost/blog</link>
<description>Welcome to O-blog</description>
<dc:language>zh-cn</dc:language>
<copyright>O-blog</copyright>
</channel>
<item rdf:about="http://localhost/blog/archives/2008/03/17/48.html">
<title>asdfas</title>
<link>http://localhost/blog/archives/2008/03/17/48.html</link>
<description><![CDATA[ dfasdfadsf]]></description>
<dc:date>Mon, 17 Mar 2008 15:37:22 +0800</dc:date>
<guid>http://localhost/blog/archives/2008/03/17/48.html</guid>
</item>
<item rdf:about="http://localhost/blog/archives/2008/03/17/asf.html">
<title>asdf</title>
<link>http://localhost/blog/archives/2008/03/17/asf.html</link>
<description><![CDATA[ asdfa]]></description>
<dc:date>Mon, 17 Mar 2008 15:34:39 +0800</dc:date>
<guid>http://localhost/blog/archives/2008/03/17/asf.html</guid>
</item>
<item rdf:about="http://localhost/blog/archives/2008/03/17/46.html">
<title>ttt</title>
<link>http://localhost/blog/archives/2008/03/17/46.html</link>
<description><![CDATA[ ttttt]]></description>
<dc:date>Mon, 17 Mar 2008 15:31:28 +0800</dc:date>
<guid>http://localhost/blog/archives/2008/03/17/46.html</guid>
</item>
</rdf:RDF>自己看看,这是生成的xml
一般的RSS文档结构:<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>CNN.com</title>
<link>http://www.example.org</link>
<description>A short description of this feed</description>
<language>en</language>
<pubDate>Mon,17 Oct 2005 07:56:23 EDT</pubDate>
<item>
<title>Catchy Title</title>
<link>http://www.example.org/2005/11/catchy-title.html</link>
<description>The description can hold any content you wish,including XHTML.</description>
<pubDate>Mon,17 Oct 2005 07:55:28 EDT</pubDate>
</item>
<item>
<title>Another Catchy Title</title>
<link>http://www.example.org/2005/11/another-catchy-title.html</link>
<description>The description can hold any content you wish,including XHTML.</description>
<pubDate>Mon,17 Oct 2005 07:55:28 EDT</pubDate>
</item>
</channel>
</rss>
<channel>
<title>CNN.com</title>
<link>http://www.example.org</link>
<description>A short description of this feed</description>
<language>en</language>
<pubDate>Mon,17 Oct 2005 07:56:23 EDT</pubDate>
<item>
<title>Catchy Title</title>
<link>http://www.example.org/2005/11/catchy-title.html</link>
<description><p>The description can hold any content you wish,including XHTML.</p><p>The description can hold any content you wish,including XHTML.</p></description>
<pubDate>Mon,17 Oct 2005 07:55:28 EDT</pubDate>
</item>
</channel>
</rss>
<image>
<link>http://127.0.0.1:81/</link>
<url>http://127.0.0.1:81/images/banner.gif</url>
<title>我的blog - Tracking Web 2.0</title>
</image>还有很多东东的哦
<lastBuildDate>2008-12-10 11:23:48</lastBuildDate>
<generator>blog RSS</generator>
找本xml语法书看看
重来
<?xml version="1.0" encoding="gbk" ?>
- <rss version="2.0">
- <channel>
<title>RSS名称</title>
- <image>
<title>RSS名称</title>
<link>http://www.iRSSer.com/</link>
<url>http://www.iRSSer.com/images/iRSSer_88x31.gif</url>
</image>
<description>RSS简介</description>
<link>http://www.iRSSer.com/</link>
<language>zh-cn</language>
<docs>RSS名称</docs>
<generator>RSS Generator By RSSMaker JSP版 v1.0</generator>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=32</link>
<author>刘广</author>
<pubDate>2010-01-18 11:16:05</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=31</link>
<author>刘广</author>
<pubDate>2010-01-18 11:16:05</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=30</link>
<author>刘广</author>
<pubDate>2010-01-18 11:16:05</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=29</link>
<author>刘广</author>
<pubDate>2010-01-18 11:16:05</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=28</link>
<author>刘广</author>
<pubDate>2010-01-18 11:16:05</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=27</link>
<author>刘广</author>
<pubDate>2010-01-18 11:16:05</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=26</link>
<author>刘广</author>
<pubDate>2010-01-18 11:16:05</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=25</link>
<author>刘广</author>
<pubDate>2010-01-18 11:16:05</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=24</link>
<author>刘广</author>
<pubDate>2010-01-18 11:16:05</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=23</link>
<author>刘广</author>
<pubDate>2010-01-18 11:16:05</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=22</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:48</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=21</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:48</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=20</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:48</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=19</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:48</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=18</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:48</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=17</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:48</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=16</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:48</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=15</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:48</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=14</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:48</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=13</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:48</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=12</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:23</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=11</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:23</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=10</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:23</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=9</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:23</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=8</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:23</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=7</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:23</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=6</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:23</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=5</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:23</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=4</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:23</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
- <item>
- <title>
- <![CDATA[ 测试2
]]>
</title>
<link>http://www.irsser.com/article.asp?id=3</link>
<author>刘广</author>
<pubDate>2010-01-18 11:15:23</pubDate>
- <description>
- <![CDATA[ 摘要2
]]>
</description>
</item>
</channel>
</rss>