All i need is someone to help me with my script so that every node in the array goes through the if..else.. statments, with the end result of an array of $albums and an array of $images. I'm still very new to this :bemused:

Notice: Undefined variable: album on line 24

Any suggestions?

I have the file "sort.php"

<?php
//loads the XML file
$xmlPath = dirname(__FILE__) . "/";
$xmldoc = domxml_open_file($xmlPath . "gallery_tree.xml");

//root node "tree"
$root = $xmldoc -> document_element();

//Gets all Nodes as an array??
$nodes = $xmldoc -> get_elements_by_tagname("node");

//If node has attributes "label" and "src" then it is an image
//Else the node is an "album"
foreach($nodes as $node) {
if ($node -> has_attribute("label")) {
       if ($node -> has_attribute("src"))
        $image = $node;
        }
   else {
         $album = $node;
        }
}
print_r($album);
?>

I also have the file "gallery_tree.xml"

<?xml version="1.0"?> 
<tree>
	<node label="Vacation Pic's!">
		<node label="AirFrance" src="images/AirFrance.jpg" />
		<node label="Eiffel_J" src="images/Eiffel_J.jpg" />
		<node label="EiffelLunch" src="images/EiffelLunch.jpg" />
		<node label="EiffelTower" src="images/EiffelTower.jpg" />
	</node>
	<node label="New Album">
		<node label="TEST" src="images/blah.jpg" />
	</node>
</tree>
    Write a Reply...