Jump to content

Interpreting XML into an Object Question


foochuck

Recommended Posts

I'm using the function 'simplexml_load_file'

 

Here is the code I'm using:

 

<?php $featuredImgs = "http://foochuck.com/pixelpost/index.php?x=rss"; 
$xml = simplexml_load_file($featuredImgs);
if (count($xml->image) > 0) {
foreach ($xml->image as $node) {
	echo "<li><a rel=\"shadowbox;\" title=\"" . $node->title . "\" href=\"" . $node->description . "\" border=\"0\" alt=\"" . $node->title . "\"></a></li>\n";
}
}
?>

 

However this PHP code returns nothing. I'm wondering if I can't interpret $featuredImgs since that file is not an XML file, but rather a PHP file pulling in a variable.

 

Is that correct & if so, is there a work around?

 

If that's wrong, what am I doing wrong? I'm just trying to create an unordered list of items from the xml feed object.

 

-foochuck

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.