php xml

Links for php scripts

Moderators: macek, egami, gesf

kristtee
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Jun 12, 2011 7:08 pm

php xml

Postby kristtee » Sun Jun 12, 2011 7:30 pm

Hello
I am no good in scripting, yet i am trying. I have folder full of images. I want to write a phpscriipt to read the folder and generate an xml file as
<root>
<file>
<name> [this should be image file name] </name>
<loc> [image path with extension]</loc>
</file>
<file>
<name> [this should be image file name] </name>
<loc> [image path with extension]</loc>
</file>
</root>

is it possible to do it?
hope it can be done. please help me.
thanks
krish

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: php xml

Postby johnj » Sun Jun 12, 2011 11:12 pm

use opendir() and readdir() to get all the files in a directory. Once you have the filenames and path, go ahead and generate an xml. Instead of opendir() and readdir(), you can also try scandir(). Please read more about this on php.net.


Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest

cron