2010-01-21 100 views
1

我想添加內容到我的Joomla!通過使用由我是其附屬公司提供的.xml供稿。 該公司提供了一個.xml訂閱源,以便分支機構可以自動完成更新。我認爲我可以使用內置的新聞閱讀器,但公司的技術支持人員很快就告訴我,RSS閱讀器不會完成這項工作。儘管在我看來,rss feed reader基本解析了.xml文件?如何將xml文件放入網站?

有沒有人有任何有Joomla的經驗或建議!顯示不是rss的.xml提要的結果?

<?xml version="1.0" encoding="utf-8" ?> 
<videos> 
<item> 
<title>Raja Mahal</title><categories>Movies</categories><genre>Drama, Action &amp; Adventure</genre><description>A Zamindar’s son working as an ordinary mill worker gives shelter to an escaped convict. The convict, however, dupes his benefactor and goes to the Zamindar’s place posing as the heir to the property. &lt;br/&gt;&lt;br/&gt;</description><vid>52585</vid><keywords>Drama, crime, thriller, stunts, revenge, Krishna, Vijaya Lalitha, Krishnam Raju, Telugu Movies, 70s movies, K.V. Chalam, Jyothi Lakshmi, Rama Kameswara, </keywords><duration>136.10</duration><embed>&lt;object width="425" height="355"&gt;&lt;param name="movie" value="http://www.rajshritelugu.com/players/affplayer.swf?blogid=A6D70264-037C-453B-8A01-1089F183E5A7_1070&amp;flashpath=http://www.rajshritelugu.com/"&gt;&lt;/param&gt;&lt;embed src="http://www.rajshritelugu.com/players/affplayer.swf?blogid=A6D70264-037C-453B-8A01-1089F183E5A7_1070&amp;flashpath=http://www.rajshritelugu.com/" type="application/x-shockwave-flash" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;</embed><thumbnail>http://rajshri-c-18.vo.llnwd.net/d1/content/Telugu/Movies/52585.jpg</thumbnail> 
</item> 
<item> 
<title>Bezawada Bebbuli</title><categories>Movies</categories><genre>Drama, Action &amp; Adventure</genre><description>A righteous lawyer is killed when the thug he wants to expose kills him. One of his sons grows up to become a cop while the younger one becomes a criminal. </description><vid>52579</vid><keywords>Drama, suspense, thriller, revenge, comedy, humour, Krishna, Sri Priya, Radhika, Sivaji Ganesan, Satyanaryana, Sutti Verabhadra Rao, Shyamala Gouri, Sowcar Janaki, Mada, Sakshi Ranga Rao</keywords><duration>112.09</duration><embed>&lt;object width="425" height="355"&gt;&lt;param name="movie" value="http://www.rajshritelugu.com/players/affplayer.swf?blogid=C53B4659-1E82-4152-82A7-5FBF162BDB66_1070&amp;flashpath=http://www.rajshritelugu.com/"&gt;&lt;/param&gt;&lt;embed src="http://www.rajshritelugu.com/players/affplayer.swf?blogid=C53B4659-1E82-4152-82A7-5FBF162BDB66_1070&amp;flashpath=http://www.rajshritelugu.com/" type="application/x-shockwave-flash" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;</embed><thumbnail>http://rajshri-c-18.vo.llnwd.net/d1/content/Telugu/Movies/52579.jpg</thumbnail></item> 
</videos> 

這是URL從我得到了這個XML文件: http://www.rajshri.com/syndicate/?uid=1070&sig=b20aee5e1336fb1ffb4f520e67e89a75&lang=telugu&channel=movies

+1

非常模糊的問題。請細化。 – 2010-01-21 13:16:11

+0

爲什麼你要把這個XML數據放在你的網站上?你不能只是指向鏈接? – 2010-01-21 13:16:59

+0

你想在網頁上顯示什麼?提取細節並以定義的方式顯示或僅顯示此信息。 – rahul 2010-01-21 13:17:07

回答

3

首先,RSS閱讀器讀取XML。但它讀取具有特定結構(RSS)的XML文件。上面顯示的文件源不在RSS結構中,因此RSS閱讀器無法理解它。一個更通用的XML閱讀器將能夠爲你解析它,但你需要告訴它如何處理數據(它本質上不知道你想如何將各種元素放置在頁面上)。

Joomla構建於PHP之上,可以添加擴展和用戶創建的代碼。通常這符合模型/控制器/視圖設計原則,但是如果您只創建一個獲取XML的PHP​​頁面,使用PHP的XML解析器解析它,並將所需內容回顯出來,則可以將其作爲組件安裝到Joomla中並有一個菜單項指向它,或者將它安裝爲一個模塊,並讓它出現在另一個頁面的邊欄中。

如果你不想處理Joomla的內部工作,你可以在你的服務器上使用外部腳本(使用PHP或其他編程語言),從遠程服務器捕獲XML文件,並用它的解析XML閱讀器,並轉換並輸出RSS結構XML文件中的相同內容。然後,您可以將Joomla的RSS閱讀器指向作爲數據解釋器的外部腳本。

或者,如果您的目標是允許用戶從您的網站下載文件並對其執行其他操作,可以將文章中的鏈接放在遠程服務器上的文件中,或者安裝一個類似Phoca Download的擴展名,允許您的Joomla安裝自己託管文件並跟蹤下載次數並設置文件的安全性。

+0

感謝您的解釋 – musicking123 2010-01-25 12:06:37

0

創建一個名爲 「XMLFILES」 在你的網站上的一個文件夾。在名爲「Videos.xml」的文件夾中創建一個文件,並將XML放入文件中。

+0

我編輯的問題,請幫助我。 – musicking123 2010-01-21 13:40:19

相關問題