Forum Moderators: open
Anyway, i recently bought a PSP wallpapers site, and while changing the structure, thought it would be good to use XML to call on all the images/links/reviews etc
A small piece of my XML looks like this:
<wallpapers>
<anime>
<title name="Bleach">
<page url="../pages/anime/bleach/bleach_01.html" />
<image url="../images/wallpapers/free_psp_wallpapers_anime_bleach_01.jpg" />
<image url="../images/wallpapers/free_psp_wallpapers_anime_bleach_02.jpg" />
</title>
</anime>
<girls>
<title name="Amanda">
<page url="../pages/girls/amanda/amanda_01.html" />
<image url="../images/wallpapers/free_psp_wallpapers_girls_amanda_01.jpg" />
<image url="../images/wallpapers/free_psp_wallpapers_girls_amanda_02.jpg" />
</title>
</girls>
</wallpapers>
I can display the title and 1 image of each, or all images in a long list, but now i want to call upon all the images by one game/one tv show etc, and i dont know how.....
Any help would be greatly appreciated.
Thank you.
Haydn
[edited by: Sublime at 11:47 am (utc) on Feb. 19, 2008]
Im new to using UML
I assume that you mean "XML." UML [uml.org] is a bit different from XML [w3.org]
This can be done in PHP. Probably, the easiest thing to do would be to read the XML file into a DOMDocument [us3.php.net] and then sort through it there. You could also use XSLT, but, if you are new to this, that may be a bit too much to bite off.
Hope this helps.
Ive been using XML and XSLT to control RSS feeds and the like, but havn't used them with my own conent.
Didnt think it would be that hard. Using the XML example i gave, isnt it straight forword to say call on all images under the title of "Bleach"?
I sent you to the "LoadXML()" function of DOMDocument. The input to that can [usually] be a URI.
Once its in there, you have the XML file in a traversable object structure, and you can loop through it.
DOMDocument is also the beginning of using the PHP XSLTProcessor class [us.php.net].
Give it a try. Experiment with a basic PHP file. You'll see what I mean (disclaimer: DOMDocument and XSLTProcessor require PHP 5 and up).
In any case, using DOMDocument, you could pretty easily filter for the <bleach/> element, but it would be easier to use XSLT. If you are already familiar with XSLT, then you're halfway there.