Hi there, first I’ll just say thanks to all at kirupa.com for the great tuts.
Down to business, I have created my own photo gallery that uses XML for the image and thumbnail paths, I have had a look at the XML Photo Gallery (I’ll use the term **XPG **from now on!) tutorial on this site and found that I have mostly done the right things to get my gallery to work. The reason I looked at the gallery was actually to find out how the next and previous buttons worked as I need to get something similar working on my gallery.
The problem I have is this; my gallery uses images and thumbnails gathered from an XML file, my XML looks something like the following code:
<gallery>
<group>
<image source="pics/pic1.jpg" thumb="pics/th1.jpg" />
<image source="pics/pic2.jpg" thumb="pics/th2.jpg" />
<image source="pics/pic3.jpg" thumb="pics/th3.jpg" />
<!-- 12 more entries -->
</group>
<group>
<image source="pics/pic16.jpg" thumb="pics/th16.jpg" />
<!-- 14 more entries -->
</group>
<group>
<image source="pics/pic31.jpg" thumb="pics/th31.jpg" />
<!-- 14 more entries -->
</group>
</gallery>
So my gallery will display 15 thumbs per page and the image and source are collected using the [color=Navy]attributes[/color].source and [color=Navy]attributes[/color].thumbs method.
When looking into the source of the XPG tutorial the XML is different in that it uses the [color=Navy]nodeValue [/color][color=Black]to obtain the required paths so it has me a little confused. What I need to do is navigate through the groups the same way as the XPG navigates through images but I fail when I try to set up the initial loding function, simlply because I cant get my head around the script (I am a complete novice by the way).
My question is this, How can I modify the following part of the code so that it can interact with my XML file?
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
As far as I can tell I would need to add a variable for the group element and thats about as far as I am able to go with it. I have tried many different approches but so far I have had no joy, the best I have come up with will only display four thumbs and they are all the first image in the XML file.
If anybody has any suggestions I would be very greatfull for the assistance, if I have not made my intentions clear enough I will try to expand on this post.
Thanks in advance!
[/color]