Je découvre ce site et je sens que je vais me plaire ici
Je suis en train de préparer une insertion de flux pour mon site, grâce à la méthode d'Americas trouvée sur ce forum j'ai réussi à Regrouper des flux rss de plusieurs sites mais je voudrais savoir si il est possible de les classer chronologiquement du plus récent au plus ancien
Voici le code :
CODE
<?php
include('filsrss/rss_fetch.inc');// Set error reporting for this
$rss = fetch_rss('http://www.pcinpact.com/include/news.xml');
if ($rss)
{
// Split the array to show first 3
$items = array_slice($rss->items, 0, 2);
// Cycle through each item and echo
foreach ($items as $item )
{
$title = $item['title'];
$link = $item['link'];
$pubdate = $item[pubdate];
# Si on veut la date...
$pubdate = date("d/m", strtotime($pubdate));
echo "<small>$pubdate</small> : <a href=\"$link\">$title</a> ";
echo "<small>[",$rss->channel['title'],"]</small><br />\n";
}}else { echo '<h2>Error:</h2><p>'.magpie_error().'</p>';}
// Restore original error reporting value_AT_ini_restore('error_reporting');
?>
<?php
# include('filsrss/rss_fetch.inc');// Set error reporting for this
$rss = fetch_rss('http://www.presence-pc.com/feeds/1385-rss2-presence-pc.xml');
if ($rss)
{
// Split the array to show first 3
$items = array_slice($rss->items, 0, 2);
// Cycle through each item and echo
foreach ($items as $item )
{
$title = $item['title'];
$link = $item['link'];
$pubdate = $item[pubdate];
# Si on veut la date...
$pubdate = date("d/m", strtotime($pubdate));
echo "<small>$pubdate</small> : <a href=\"$link\">$title</a> ";
echo "<small>[",$rss->channel['description'],"]</small><br />\n";
}}else { echo '<h2>Error:</h2><p>'.magpie_error().'</p>';}
// Restore original error reporting value_AT_ini_restore('error_reporting');
?>
<?php
# include('filsrss/rss_fetch.inc');// Set error reporting for this
$rss = fetch_rss('http://www.clubic.com/xml/news.xml');
if ($rss)
{
// Split the array to show first 3
$items = array_slice($rss->items, 0, 2);
// Cycle through each item and echo
foreach ($items as $item )
{
$title = $item['title'];
$link = $item['link'];
$pubdate = $item[pubdate];
# Si on veut la date...
$pubdate = date("d/m", strtotime($pubdate));
echo "<small>$pubdate</small> : <a href=\"$link\">$title</a> ";
echo "<small>[",$rss->channel['generator'],"]</small><br />\n";
}}else { echo '<h2>Error:</h2><p>'.magpie_error().'</p>';}
// Restore original error reporting value_AT_ini_restore('error_reporting');
?>
<?php
# include('filsrss/rss_fetch.inc');// Set error reporting for this
$rss = fetch_rss('http://www.hardware.fr/backend/news.xml');
if ($rss)
{
// Split the array to show first 3
$items = array_slice($rss->items, 0, 2);
// Cycle through each item and echo
foreach ($items as $item )
{
$title = $item['title'];
$link = $item['link'];
$pubdate = $item[pubdate];
# Si on veut la date...
$pubdate = date("d/m", strtotime($pubdate));
echo "<small>$pubdate</small> : <a href=\"$link\">$title</a> ";
echo "<small>[",$rss->channel['title'],"]</small><br />\n";
}}else { echo '<h2>Error:</h2><p>'.magpie_error().'</p>';}
// Restore original error reporting value_AT_ini_restore('error_reporting');
?>
<?php
# include('filsrss/rss_fetch.inc');// Set error reporting for this
$rss = fetch_rss('http://www.touslesdrivers.com/php/scripts/news_rss.php');
if ($rss)
{
// Split the array to show first 3
$items = array_slice($rss->items, 0, 2);
// Cycle through each item and echo
foreach ($items as $item )
{
$title = $item['title'];
$link = $item['link'];
$pubdate = $item[pubdate];
# Si on veut la date...
$pubdate = date("d/m", strtotime($pubdate));
echo "<small>$pubdate</small> : <a href=\"$link\">$title</a> ";
echo "<small>[",$rss->channel['title'],"]</small><br />\n";
}}else { echo '<h2>Error:</h2><p>'.magpie_error().'</p>';}
// Restore original error reporting value_AT_ini_restore('error_reporting');
?>
Ce qui donne ça
19/12 : Google et la Nasa décrochent la Lune et Mars [PC INpact]
19/12 : Panasonic annonce des batteries Lithium-Ion ignifugées [PC INpact]
19/12 : NEC met le feu aux ordinateurs de bureau [Presence PC]
18/12 : Rainbow Six Vegas : le test [Presence PC]
19/12 : Quelques images de plus pour Test Drive Unlimited [Clubic]
19/12 : BluOnyx : le distributeur de contenus sans fil [Clubic]
19/12 : Soucis entre nForce 680i SLi & SATA [HardWare.fr]
19/12 : DDR2 1Gb 60nm chez Hynix [HardWare.fr]
19/12 : Quoi de neuf dans les ForceWare 93.81 beta? [TousLesDrivers.com]
18/12 : Modems ADSL SpeedTouch et Windows Vista x64 [TousLesDrivers.com]
