php/xml driven photo manager?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
plebeian3644
Forum Newbie
Posts: 1
Joined: Sat Sep 13, 2008 12:15 pm

php/xml driven photo manager?

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: php/xml driven photo manager?

Post 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
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply