Bonjour,

j'utilise la dernière version de simplepie comme cela:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
<?php
require_once('./pie/simplepie.inc');
 
$flux1 = new SimplePie();
$flux1->set_feed_url('http://feeds.feedburner.com/Aful-CommuniqusDePresseEtNouvelles');
$flux1->set_item_limit(10);
$flux1->set_cache_duration(999999);
$flux1->init();
 
$flux2 = new SimplePie();
$flux2->set_feed_url('http://www.april.org/serveur/april.xml');
$flux2->set_item_limit(5);
$flux2->set_cache_duration(999999);
$flux2->init();
 
// Let's merge them together.
$merged = SimplePie::merge_items(array($flux1, $flux2));
header('Content-type:text/html; charset=utf-8');
?>
et le code dans le <body> est:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
<div id="site">
<h1>Awesome feeds</h1>
<?php
// Instead of calling $feed->get_items(), we'll use the $merged variable we created earlier.
foreach ($merged as $item):
?>
 
<div class="chunk">
<?php /* Here, we'll use the $item->get_feed() method to gain access to the parent feed-level data for the specified item. */ ?>
<h4 class="title" style="background-image:url(<?php $feed = $item->get_feed(); echo $feed->get_favicon(); ?>);"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h4>
<?php echo $item->get_content(); ?>
<p class="footnote">Source: <a href="<?php $feed = $item->get_feed(); echo $feed->get_permalink(); ?>"><?php $feed = $item->get_feed(); echo $feed->get_title(); ?></a> | <?php echo $item->get_date('j M Y | g:i a T'); ?></p>
</div>
 
<?php endforeach; ?>
</div>
Et donc j'ai cette erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Warning: Invalid argument supplied for foreach() in /home/toto/website/index.php on line 801
Qui correspond à cette ligne:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
foreach ($merged as $item):
Quel est le problème?

++