MyBB Community Forums

Full Version: Warning[2] Invalid argument supplied foreach()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I got this error, today and on refresh it goes away,

[Image: 9pxbhs.jpg]
Can you paste your index template here?
template removed as the thread is solved

I said index template - not index.php

Line 343 is:

eval("\$index = \"".$templates->get("index")."\";");

Indicating there is an issue with the template.
:p template posted above
I assume are you using PHP in Templates plugin?

One thing is that the first XML code is incrementing J but you are using I.

Next, if there is no XML output, the foreach fails since the variable is not initialized.

<? 
$i=0;
$xml=simplexml_load_file("http://vubscs.tk/syndication.php?fid=70,79,83,87,91,95,151,107,112,117,122,131,179,214,183,189,19​3,170,240,245&limit=15");
if(isset($xml->channel->item)){
foreach($xml->channel->item as $myentry) {  
if($i==10) break;
echo "<a href='$myentry->link' title='$myentry->title'>" . $myentry->title . "</a><hr>"; 
 $i++;}  }
?>
thanks, solved