Input:
Code: Alles auswählen
?><?php
/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname : Insert RSS feed
* Copyright : Contenido - four for business
* Authors: : Timo Hummel, Andreas Lindner
* Created : 30.09.2005
************************************************/
echo '<table>';
echo '<tr><td>'.mi18n("Name").'</td><td><input type="text" name="'."CMS_VAR[3]".'" value="'."CMS_VALUE[3]".'" style="width: 320px"></td></tr>';
echo '<tr><td>'.mi18n("URL").'</td><td><input type="text" name="'."CMS_VAR[0]".'" value="'."CMS_VALUE[0]".'" style="width: 320px"></td></tr>';
echo '<tr><td>';
echo mi18n("RSS-Template auswählen").':</td><td><select name="CMS_VAR[1]" size="1" style="width: 320px">
<option value="">Nichts ausgewählt</option>';
$strPath_fs = $cfgClient[$client]["path"]["frontend"].'templates/';
$handle = opendir($strPath_fs);
while ($entryName = readdir($handle)) {
if (is_file($strPath_fs.$entryName)) {
if ("CMS_VALUE[1]"==$entryName) {
echo '<option selected value="'.$entryName.'">'.$entryName.'</option>';
} else {
echo '<option value="'.$entryName.'">'.$entryName.'</option>';
}
}
}
echo '</select></td></tr>';
echo '<tr><td>'.mi18n("Anzahl Einträge").'</td><td><input type="text" name="'."CMS_VAR[2]".'" value="'."CMS_VALUE[2]".'"</td></tr>';
echo '</table>';
?><?php
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Insert RSS feed
* Authors: : Timo Hummel, Andreas Lindner
* Copyright : Contenido - four for business
* Created : 30.09.2005
************************************************/
cInclude("pear", "XML/Parser.php");
cInclude("pear", "XML/RSS.php");
{
echo '<div id="rssname">'.mi18n("CMS_VALUE[3]").'</div>';
}
if ("CMS_VALUE[0]" == "")
{
$sFeed = "http://www.contenido.org/rss/de/news";
}
else {
$sFeed = "CMS_VALUE[0]";
}
if ("CMS_VALUE[2]" == "")
{
$FeedMaxItems = 999;
} else {
$FeedMaxItems = intval("CMS_VALUE[2]");
}
/* Preparse feed for an encoding due to the poorly designed
PHP XML parser */
$sFeedContent = substr(@file_get_contents($sFeed),0,1024);
$regExp = "/<\?xml.*encoding=[\"\'][\"\']\?>/i";
preg_match($regExp,trim($sFeedContent),$matches);
if ($matches[1])
{
$rss =& new XML_RSS($sFeed, $matches[1]);
} else {
$rss =& new XML_RSS($sFeed);
}
$rss->parse();
$tpl = new Template;
$i = 0;
foreach ($rss->getItems() as $item)
{
if ($i < $FeedMaxItems) {
$tpl->set("d", "TITLE",utf8_decode($item['title']));
$tpl->set("d", "LINK",htmlentities($item['link'],ENT_QUOTES));
$tpl->set("d", "DESCRIPTION", utf8_decode(htmlentities($item['description'],ENT_QUOTES)));
$tpl->set("d", "READ_ON", mi18n("weiterlesen"));
$tpl->next();
}
$i++;
}
$tpl->generate($cfgClient[$client]["path"]["frontend"]."templates/"."CMS_VALUE[1]");
?>
Ich bin mir nicht sicher ob alles richtig ist aber bei mir funktioniert es.