Форуми / Cotonti / Support / Import XML feed

Twiebie
#1 06.11.2010 02:15
I couldn't find a solution by using the search function, my question is what the easiest way is to import a .xml feed into a page?

I tried using: include:http://www.xmlfeedurl.com/feed.xml but that wont work because it's trying to import a page from a folder on the server.

Thanks in advance.
Kort
#2 06.11.2010 03:46
[Commercial Plugin] RSS Reader:

Demo: http://sandbox.seditio.by/
SED.by - создание сайтов, разработка плагинов и тем для Котонти
Kaan
#3 06.11.2010 07:30
Twiebie
#4 06.11.2010 07:41
I used that one when I was still using Seditio, but i'm having problems with it on Cotonti.

I thought maybe there was a simple option in Cotonti.
vice
#5 14.11.2010 16:42
If you know a little PHP, then you can write your own plugin. I used to write for themselves, this RSS graber.
echo '<div id="main"><div align="justify">'; 
//point to an xml file
$feed = "http://www.opennet.ru/opennews/opennews_mini_full.rss";
//create object
$sxml = simplexml_load_file($feed);
echo "<center><h2> ГОРЯЧИЕ НОВОСТИ. ПОДРОБНО. 
</h2></center>
<img align=left src=skins/ice/img/cofcup.jpg > 
 <br><br>";
//echo "<h2>{$sxml->channel->title}</h2>\n";
$i = 1;
foreach ($sxml->channel->item as $item){
$strtemp = "<font color=blue>$item->title</font><br>$item->description<br>";
$strtemp = iconv("utf-8", "windows-1251", $strtemp);  
$strtemp = strip_tags($strtemp, '<p><br><font>');
$newtext = ereg_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])|Источник:","",$strtemp);
echo $newtext;
echo '<center><img src=skins/ice/img/cup.png>&nbsp
<img src=skins/ice/img/cup.png>&nbsp
<img src=skins/ice/img/cup.png>
</center><br>';
$i++;
if ($i > 5) break;  
} 
echo '</div></div>';

An example of how it looks http://linux.povorotka.org.ua/plug.php?e=feed