for loop question
Posted: Tue Dec 01, 2009 12:38 pm
I want to loop through the first 5 records in my xml. How would I format this correctly. Its nto displaying any of my xml.
Code: Select all
<?php
$Gadgets = simplexml_load_string(file_get_contents('http://www.flashmajic.com/gadgets.xml'));
//foreach ($Gadgets->Site as $Site)
for($x=0;$x<6;$x++)
{
echo '<tr>';
echo '<td valign="top">';
echo '<h5>'.$Site[$x]->Title.'</h5>';
echo '<h6><img src="'.$Site[$x]->Image.'"/></h6>';
echo '</td>';
echo '<td valign="top">';
echo '<h5>'.$Site[$x]->Title.'</h5>';
echo '<h6>'.$Site[$x]->description.'</h6>';
echo '<h6><a href="'.$Site[$x]->links.'">Add Module To Your Google Page.</h6></a>';
echo '</td>';
echo '</tr>';
}
?>