Page 1 of 1

Script works in one directory, but not in another...

Posted: Fri Jan 30, 2009 12:28 pm
by Still Learning
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.

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];
 
?>
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.
title: 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
I got the same error message when I tried to access the file using the

Code: Select all

$root = $_SERVER['DOCUMENT_ROOT'];
method of accessing the file where all the other xspf files are stored.


Going NUTZ plz help. :banghead:

Re: Script works in one directory, but not in another...

Posted: Fri Jan 30, 2009 1:35 pm
by requinix
Where's the version of the script that doesn't work?

Re: Script works in one directory, but not in another...

Posted: Sat Jan 31, 2009 7:46 pm
by Still Learning
tasairis wrote:Where's the version of the script that doesn't work?
The scripts are identical. That's what I can't figure out. The xspf file is located in both folders, and it's being accessed with a relative url.

I copied the file from one folder and put it in another folder (the main one that has all the xspf files) and it didn't work. Same scripts.

Re: Script works in one directory, but not in another...

Posted: Thu Feb 05, 2009 1:40 pm
by Still Learning
JUST FIGURED OUT WHAT WAS WRONG. THE XSPF FILE IN THE OTHER DIRECTORY HAD "TrackList" WHEN THE OTHER XSPF FILE HAD "Tracklist".

Amazing how much trouble a capital "L" can get you into.
Problem resolved.