2011-01-03 10:06:27 +00:00

46 lines
1.3 KiB
PHP

<div id="news" style="clear:both;margin:5px 0 5px 20px;">
<?php
// News
if ( hasPref('news') ){
/* Information presse 15 Aug 2007 09:21:49 GMT - */
require_once ('XML/RSS.php');
$url = 'http://news.google.fr/news?hl=fr&ned=fr&q='.
urlencode('"'.$etab['Nom'].'"').'&output=rss';
FB::log($url, 'url');
$rss = new XML_RSS($url);
$rss->parse();
$tabMonth = array('Jan' => 1, 'Feb' => 2, 'Mar' => 3, 'Apr' => 4,
'May' => 5, 'Jun' => 6, 'Jul' => 7, 'Aug' => 8,
'Sep' => 9, 'Oct' => 10,'Nov' => 11,'Dec' => 12);
foreach ($rss->getItems() as $i=>$item) {
if ($i == 0) {
?>
<span class="StyleInfoLib">Information presse (Source Google News &copy;)</span><br/>
<ul>
<?php
}
$tmp=explode(', ', $item['pubdate']);
$tabDate = explode(' ', $tmp[1]);
$tabTime = explode(':', $tabDate[3]);
$pubDate = date('d/m/Y à H:i', gmmktime($tabTime[0]-1, $tabTime[1], $tabTime[2], $tabMonth[$tabDate[1]], $tabDate[0], $tabDate[2]));
$titre = $item['title'];
?>
<li>
<a href="<?php echo $item['link'];?>" target="_blank">
Le <?php echo $pubDate;?> - <?php echo $titre;?>
</a>
</li>
<?php
$i++; if ($i==15) break;
}
if ($i>0)
{
?>
</ul>
<?php
}
}
?>
</div>