Page 5 of 6 pages « First < 3 4 5 6 >
Debra’s Dynamic Gallery
The XML Template ("ssp_xml")
The typical XML file for a SlideShowPro movie looks like this, taken directly from the user guide:
<?xml version="1.0" encoding="UTF-8"?>
<gallery>
<album title="Nature" description="Images of trees, lakes and flowers" lgPath="gallery/album1/large/">
<img src="tree.jpg" caption="A redwood tree from California" />
<img src="flower.jpg" caption="Rose bush outside my house" />
<img src="lake.jpg" caption="A beautiful lake" />
</album>
</gallery>
How the heck are we going to make that on the fly?
This part took some thinkin’ on my part, but it’s actually really simple. Code fragment provided
Let’s investigate how our XML file is being created dynamically.
It’s easiest if you compare the standard file above with ours.
After we declare the opening xml and gallery tags, we need to specify which album to display.
We call up the weblog:entries tag, and use the “entry_id” parameter to tell it which entry we want. Here’s where passing the entry ID in the URL from the thumbnail is coming in handy. It’s in second segment of the URL (nobodyreadsthis.com/gallery-flickr/11) which we’re specifying by calling {segment_2} as the value of the parameter.
(Note: your segment numbers might be different depending on how you’ve set up your site. I’ve removed index.php, and I’m not calling the template group. Whatever yours are, make sure they match in the gallery-flickr and ssp_xml templates.)
You have to turn “rdf” OFF or the code will be a big giant mess.
SlideShowPro has some different options for what gets displayed in the caption area that drops down on every photo. In my Flash movie, I’ve specified I want the album name, which is the {title} field in the our weblog.
I don’t need the description area, or to specify a path to the large images or optional thumbnails, because the full url is specified in the image source.
The next part of the code should look familiar. Yep, it’s a call to Flickr again through the eeFlickr module. Same code we used to display our thumbnails except for a few things. This time, we’re specifying we want 35 images. (per page="35"). Actually, if don’t specify, you’ll get 100. The max is 500. We’re also calling two images--the big one for the slide, and a smaller one for the thumbnail navigation, as well as a caption.
SlideShowPro has a feature that can display thumbnails in the navigation area. I have that turned on. The tn="” bit tells it where those pics are.
The Flickr API defines what you’ll get if you put different letters there. The “_s” returns a photo that’s a square thumbnail at 75pixels. If no suffix is specified, a photo that measures 500px on the longest size is returned. And, whaddya know, that’s the width of our movie!
The caption in the XML file returns whatever title the person gave their file when they uploaded it to Flickr.
Next: In Conclusion