erikjauli Posted March 18, 2009 Share Posted March 18, 2009 Hi... I'm extremely new to php and am having some trouble getting a php script to function. I've built a basic flash slideshow using actionscript and xml. I'm now trying to figure out how to use php to dynamically re-create this xml by reading the contents of a directory. I was able to find a php script that is supposed to do this here: http://fromvega.com/wordpress/2007/05/13/xml-generator-dir/ I'm having a hard time getting the script to run, and I'm not sure what I'm doing wrong. I am using MAMP to manage/test my site locally. I go to: http://localhost/test/xmlgen.phps and i get this message : Not Found The requested URL /test/xmlgen.phps was not found on this server. Apache/2.0.59 (Unix) PHP/5.2.6 DAV/2 Server at localhost Port 80 If I change the filename to xmlgen.php and then go to : http://localhost/test/xmlgen.php ... i just see the code as plain text. The only aspects of the code ive changed are these 3 variables: // list of directories to be read with no trailing slash $directoryList = array('test/fotos'); // name of the XML file $xmlFileName = 'library.xml'; // name of the XML model $xmlModelName = 'model.xml'; Anyone have any idea what I'm missing here? Any help would be appreciated, thanks. -Erik Quote Link to comment Share on other sites More sharing options...
WolfRage Posted March 18, 2009 Share Posted March 18, 2009 Why are you using ".phps"? Does your local host work normally as in it is all setup and can access index.php and parses it correctly? Quote Link to comment Share on other sites More sharing options...
erikjauli Posted March 18, 2009 Author Share Posted March 18, 2009 the file I downloaded from the tutorial had the extension ".phps". The local host seems to be working normally. If i go to http://localhost/test, then my index.html page loads properly. As I said i am very new to php, so I'm not sure exactly what you mean by "can access index.php and parses it correctly?". Quote Link to comment Share on other sites More sharing options...
WolfRage Posted March 18, 2009 Share Posted March 18, 2009 Here make a page like this: <?php echo 'hello I am working.'; ?> save it as index.php, then call this file from localhost. If you only see "hello I am working." then php is parsing the file, but if you see everything then your server is not setup correctly. As for the other file relabel it .php instead of .phps ..... Post back. Quote Link to comment Share on other sites More sharing options...
erikjauli Posted March 18, 2009 Author Share Posted March 18, 2009 thanks for your help / patience. Just to make sure I did everything correctly I'll explain exactly how I did this simple test. I opened dreamweaver, created a new PHP document and pasted the code you provided into the document. Here's what the code inspector in dreamweaver says: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <?php<br /> echo 'hello I am working.';<br /> ?> </body> </html> I save this file as index.php and call it from the localhost. If I ran that test correctly... then it seems like my server is not setup correctly. If that's the case, is that something i need to do within MAMP? -Erik Quote Link to comment Share on other sites More sharing options...
WolfRage Posted March 18, 2009 Share Posted March 18, 2009 You can't insert the code into dreamweaver in the design veiw, you need to get into the nuts and bolts and use code veiw. This is wrong it is html entities: <?php<br /> echo 'hello I am working.';<br /> ?> Insert straight into code veiw this. <?php echo 'hello I am working.'; ?> Quote Link to comment Share on other sites More sharing options...
erikjauli Posted March 18, 2009 Author Share Posted March 18, 2009 ok fixed that, called it from the local host and now i just see "hellow i am working". So I guess its not an issue with the way my server is set up. Quote Link to comment Share on other sites More sharing options...
WolfRage Posted March 18, 2009 Share Posted March 18, 2009 No it is not, so did you rename the other file to .php yet? then we will go from here a step at a time, have to learn to walk before you can run. Quote Link to comment Share on other sites More sharing options...
erikjauli Posted March 18, 2009 Author Share Posted March 18, 2009 yes... yeah i know I'm getting a little ahead of myself, but I'm slowly learning. For the other file I now recreated a proper php file using code view. Almost have it working. Now when I call that file from localhost I get this message: ------------------------------------------- fromvega XML Generator 2 - fromvega.com --------------------------------------------- Creating XML file for 'test/fotos'... Couldn't open the directory 'test/fotos'. Done! I'm assuming i need to experiment with this variable of the code until I get it working properly: // list of directories to be read with no trailing slash $directoryList = array('test/fotos'); Thanks again for your help, I really appreciate it. -Erik Quote Link to comment Share on other sites More sharing options...
WolfRage Posted March 18, 2009 Share Posted March 18, 2009 Most likely you need an absolute path or you need to make sure your relative path is correct. Also I don't use Mac so I know little of nothing about your file structure... I use Linux and Windows. Quote Link to comment Share on other sites More sharing options...
erikjauli Posted March 18, 2009 Author Share Posted March 18, 2009 got it working... just need to change it from "test/fotos" to just "fotos". exciting....been trying this for two days now, haha. Thanks again. Quote Link to comment Share on other sites More sharing options...
WolfRage Posted March 18, 2009 Share Posted March 18, 2009 No problem and glad I could help, please mark solved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.