I have the following hunk of code:
What I want to do in this loop, is read in and parse an xml file containing data at the noted position. The xml file will be formated similar to:
I am able to parse the xml file out and print it to the screen, but I am having some difficulties trying to get these values assigned to variables. Can anyone offer any hints? Thanks!
Code:
if ($dh = opendir($this->stylesPath)) {
while (false !== ($file = readdir($dh))){
if ($file !="." && $file != ".."){
$this->styles[$i] = array();
$this->styles[$i]['dirname'] = $file;
// Import XML Here
// Read in style.css
$filename = $this->stylesPath."/".$this->styles[$i]['dirname']."/style.css";
$fp = fopen($filename, "r");
$contents = fread($fp, filesize($filename));
fclose($fp);
$this->styles[$i]['css'] = $contents;
$i++;
}
}
closedir($dh);
}
What I want to do in this loop, is read in and parse an xml file containing data at the noted position. The xml file will be formated similar to:
Code:
<info>
<name>Myname</name>
<author>MyAuthor</author>
</info>
I am able to parse the xml file out and print it to the screen, but I am having some difficulties trying to get these values assigned to variables. Can anyone offer any hints? Thanks!