20,7 → 20,9 |
{ |
// Initialisation des variables |
$sortie = ''; |
$titre = $options['titre']; |
$urls = $options['url']; |
$nblimite = $options['nb']; |
$tab_url = array_map('trim', explode(',', $urls)); |
if (ini_get('allow_url_fopen') != 0) { |
ini_set('allow_url_fopen', 1); |
30,13 → 32,32 |
$rss =& new XML_RSS($url); |
$rss->parse(); |
$aso_info_rss = $rss->getChannelInfo(); |
if (isset($aso_info_rss['title'])) { |
if ($titre!='') { |
$sortie .= '<h2>'.$titre.'</h2>'; |
} |
elseif (isset($aso_info_rss['title'])) { |
$sortie .= '<h2>'.$aso_info_rss['title'].'</h2>'; |
} |
$sortie .= '<ul class="syndication" >'."\n"; |
$nbannonces=0; |
$tabsortie=array(); |
foreach ($rss->getItems() as $item) { |
$sortie .= '<li><a href="'.$item['link'].'">'.$item['title'].'</a></li>'."\n"; |
$tabsortie[$nbannonces]='<li><a href="'.preg_replace ('/&/', '&', $item['link']).'">'.$item['title'].'</a></li>'."\n"; |
$nbannonces++; |
} |
//affichage du nombre limité d'annonces classées de la plus récente à la plus vieille |
if ($nblimite>0) { |
for ($i = $nbannonces-1; (($i >= $nbannonces-$nblimite)and($i>=0)); $i--) { |
$sortie .= $tabsortie[$i]; |
} |
} |
else { |
for ($i = $nbannonces-1; ($i>=0); $i--) { |
$sortie .= $tabsortie[$i]; |
} |
} |
//si toutes les annonces n'ont pas été affichées, on propose de consulter les reste des annonces |
if ($i>0) $sortie .= '<li style="margin-left:-18px;background:transparent;"><a href="http://educ-envir.org/papyrus.php?site=1&menu=21&action=1&nature='.$aso_info_rss['title'].'"><strong>'.$aso_info_rss['title'].'</strong>: toutes les annonces</a></li>'; |
$sortie .= '</ul>'."\n"; |
} |
} |