Does anyone have a PHP script that I can use that will read the contents of a directory and create an xml file into that directory?
I am implementing Cooliris onto a Joomla site and I need to create a php file that I can use that will create an xml file of the images for Cooliris to read and display into its gallery viewer.
The plan is to have multiple galleries divided by different directories and I would use the php file followed by the variable indicating which directory I would need to create the xml file for.
I hope this makes sense.
PHP script that writes XML file based on directory contents
Moderator: General Moderators
Re: PHP script that writes XML file based on directory conte
Creating an XML file is as simple as writing to any file.
Do you know the structure the XML needs to follow?
Do you know the structure the XML needs to follow?
Re: PHP script that writes XML file based on directory conte
The XML will look like this: (Any ideas?)
Code: Select all
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"
xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<item>
<title>Picture A</title>
<media:description> This one's my favorite.</media:description>
<link>pl_images/A.jpg</link>
<media:thumbnail url="http://example.com/pl_thumbs/A.jpg"/>
<media:content url="http://example.com/pl_images/A.jpg"/>
</item>
</channel>
</rss>
Re: PHP script that writes XML file based on directory conte
Oh. Just RSS.
Are you sure you need a PHP script to create a file? Can you just use the script as the RSS feed itself?
Are you sure you need a PHP script to create a file? Can you just use the script as the RSS feed itself?
Re: PHP script that writes XML file based on directory conte
The ideas of using the php script as one php file is that new files will be added to the different directories and I want to use a script that creates a new xml file that represents the updated directory. Otherwise, you are right, and I would only need to just go ahead and create the xml file and embed that in the page. But, as I mentioned, the directories will grow over time and this php file will create a new xml file and write it to that directory every time and the gallery will be able to read this newly created xml file. I hope this makes sense.