Script works in one directory, but not in another...
Posted: Fri Jan 30, 2009 12:28 pm
Going crazy again. I'm working on making a page so that artists on my website can change settings on their xspf players. This is the code for the basic page to just load their playlist, display the pictures for each song, and provide links to change either the picture or the title of the song.
It's using SimpleXML and right now I'm feeling like a simpleton! It works in one folder, but not the other. Here's the code, which is the same in both folders.
Eventually this script will have info sent to it with the artist name, for now I'm using my own music account, which I don't care if people download the songs, cause they're not very good.
This link has the desired output, which works. (Other than the fact I haven't written the code yet for each of the links in the output) The file "Xeroform.xspf" is inside the "player_settings" directory, as well as the directory I tried to place the scripts in.
http://want-signed.com/player_settings
The scripts are saved as "index.php".
This is the error message I get when I put the same script in the directory that holds all of the xspf files. FYI line 20 is line 12 in the above pasted code.
method of accessing the file where all the other xspf files are stored.
Going NUTZ plz help.
It's using SimpleXML and right now I'm feeling like a simpleton! It works in one folder, but not the other. Here's the code, which is the same in both folders.
Code: Select all
<?php
$xml = simplexml_load_file("Xeroform.xspf");
$i=0;
foreach($xml->children() as $child)
{
echo $child->getName() . ": " . $child . "<br />";
}
foreach($xml->tracklist->children() as $child)
{
echo $child->getName() . ": " . $child . " : ";
$songname[$i]= $xml->tracklist->track[$i]->annotation;
echo $songname[$i];
echo ".... " ?>
<a href="http://want-signed.com/wp-admin/changesongname.php?song_number=<?php echo $i; ?>&artist=Xeroform">
Click Here To Change Song Name</a> <?php
echo "<br />";
$tracklocation[$i]= $xml->tracklist->track[$i]->children();
echo "Song Location: " . $tracklocation[$i];
$songimage[$i]= $xml->tracklist->track[$i]->image;
echo "<br />Current Image, Click Picture To Change <br />"; ?>
<a href="http://want-signed.com/wp-admin/change_image.php?song_number=<?php echo $i; ?>&artist=Xeroform"><img src="<?php echo $songimage[$i]; ?>" width="150" height="150" alt="No Image Available"></a>
<?php echo "<br /><br />";
$i++;
}
echo "<br />Xeroform has " . $i . " tracks";
echo "<br />The 4th track's location is: " . $tracklocation[3];
echo "<br />It's name is " . $songname[3];
?>This link has the desired output, which works. (Other than the fact I haven't written the code yet for each of the links in the output) The file "Xeroform.xspf" is inside the "player_settings" directory, as well as the directory I tried to place the scripts in.
http://want-signed.com/player_settings
The scripts are saved as "index.php".
This is the error message I get when I put the same script in the directory that holds all of the xspf files. FYI line 20 is line 12 in the above pasted code.
I got the same error message when I tried to access the file using thetitle: Xeroform on Want-Signed.com
trackList:
Warning: main() [function.main]: Node no longer exists in /home/wantsigned/public_html/folderwithallxspf_files/index.php on line 20
Xeroform has 0 tracks
The 4th track's location is:
It's name is
Code: Select all
$root = $_SERVER['DOCUMENT_ROOT'];Going NUTZ plz help.