Page 1 of 1

php/xml driven photo manager?

Posted: Sat Sep 13, 2008 12:29 pm
by plebeian3644
Hi All,

So I am in need of a basic CMS for photographer websites. When I do these sites, I create XML docs that describe the details for each photo...

What I need is a way for the photographers to easily update their photos. I have been working on a AJAX/PHP solution, but this stuff is not my forte... surely there is something out there that can do this smoothly?

I could just use Wordpress but seems extremely overkill...

Any ideas?

Best,
Pleb

Re: php/xml driven photo manager?

Posted: Sat Sep 13, 2008 9:25 pm
by s.dot
simpleXMLElement() should allow you to traverse the XML easily.

Code: Select all

$xml = file_get_contents('/path/to/file.xml');
$xml = new SimpleXMLElement($xml);
 
//now you can work with your xml!
echo $xml->photos[5]->description . '<br />';
 
foreach ($xml->photos AS $photo)
{
    echo $photo->description . '<br />';
}
 
//you can even add attributes
$xml->addAttribute('resolution', 'size');
 
//and output the new xml
echo $xml->asXML();
You can check it all over here:
http://us2.php.net/manual/en/simplexml.examples.php