Page 1 of 1

Needed tutorial on XML file creation

Posted: Wed Jul 16, 2008 1:39 pm
by Trenchant
I'm integrating a gallery into a website and I need to fill an xml file with image details from a database. I haven't been able to find just a simple way to do this. It will be used in an administration area every time new photographs are added. Here's what the xml looks like:

Code: Select all

<images>
    <pic>
        <image>gallery/1.jpg</image>
        <thumbnail>gallery/s1.jpg</thumbnail>
        <caption>Some lamp on the ground</caption>
    </pic>
</images>
For a database I'm using MySQL.

Re: Needed tutorial on XML file creation

Posted: Wed Jul 16, 2008 2:10 pm
by jaoudestudios
The xml structure is correct all you need are the headers

Code: Select all

 
<?xml version="1.0" ?> 
<images>
 <pic>
  <image>gallery/1.jpg</image>
  <thumbnail>gallery/s1.jpg</thumbnail>
  <caption>Some lamp on the ground</caption>
 </pic>
</images>
 
If its a *.php file then use...

Code: Select all

 
header('Content-Type: text/xml');

Re: Needed tutorial on XML file creation

Posted: Wed Jul 16, 2008 2:23 pm
by jaoudestudios

Re: Needed tutorial on XML file creation

Posted: Wed Jul 16, 2008 6:15 pm
by Trenchant
That link to your forum worked great! Thanks a bunch. I knew there had to be an easy way of going about it.