2011-07-23 42 views
0

我正在嘗試將RSS源添加到我的頁面中,並且我卡在了添加HTML代碼的位置以及圖像,換行符等正常html代碼中是否有任何更改。php XML RSS html代碼問題

我試圖粘貼下面的代碼是從維基百科:

<?xml version="1.0" encoding="UTF-8" ?> 
<rss version="2.0"> 
<channel> 
     <title>RSS Title</title> 
     <description>This is an example of an RSS feed</description> 
     <link>http://www.someexamplerssdomain.com/main.html</link> 
     <lastBuildDate>Mon, 06 Sep 2010 00:01:00 +0000 </lastBuildDate> 
     <pubDate>Mon, 06 Sep 2009 16:45:00 +0000 </pubDate> 

     <item> 
       <title>Example entry</title> 
       <description>Here is some text containing an interesting description.</description> 
       <link>http://www.wikipedia.org/</link> 
       <guid>unique string per item</guid> 
       <pubDate>Mon, 06 Sep 2009 16:45:00 +0000 </pubDate> 
     </item> 

</channel> 
</rss> 

,但我不知道從哪裏把HTML代碼。

回答

4

我不知道你想在RSS XML HTML代碼做什麼,我假設你需要在描述發送HTML格式,你可以在CDATA包裹HTML中描述元素

<description><![CDATA[" and ends with Here is some text containing an interesting description.]]></description> 
+0

我有一些大膽的文本,ul列表,圖片和帶有換行符的隨機文本以顯示在rss Feed中。 這是我主要關心的問題。我必須在CDATA中添加它們嗎? – fxuser

+1

是的,你會需要CDATA所有這些 – Andreas

+0

太好了,謝謝。 – fxuser