Hacking the slideshow

This post is for “ovidiu”, whoever you are.

The request (from a comment on another post) was to do a slideshow from images found in a wordpress feed on his site. All I had to do was modify my XSLT file a little to convert your category feed into the format the slideshow expects.

It just goes to show how flexible things can be with XSLT. All I had to change in the slideshow code was the addition of a new parameter to specify a particular xslt file.

The new XSLT is available here. (Update: this will only work with versions prior to 0.31. After that use this one instead. It’s also much simpler.)

The new parameter to the slideshow (get the latest version from subversion at wp-plugins) lets you pass through an arbitrary xslt file. All I did was copy forward.xslt that is provided with the slideshow plugin, and modified it to extract the relevant images instead of the ones we’d normally find in a zooomr or flickr feed.

25 Responses to “Hacking the slideshow”

  1. ovidiu Says:

    WOW

    I was so surprised when Icam home and read your posts, I immediately started trying this out.

    Here are some notes, that were not clear to me from the beginning, they might help others too:

    - in the inlineRSS settings, all path fields are relative to the wp install dir
    - I am not sure if I have to add a trailing slash or not to my path.

    Still having some trouble setting it up. So here is what I did. Downloaded inlineRSS plugin, latest dev version of slideshow plugin and the modified xslt file for my needs.

    I made a copy of the original forward.xslt file and renamed ovidiu.xslt to forward.xslt

    Then after activating both plugins I saved these options:

    inlineRSS:
    Timeout: 60
    Cache path: wp-content/cache
    Cache prefix: inlRSS_
    XSLT path: /var/www/web3/web/wordpress/wp-content/plugins/dge-slideshow

    slideshow:
    Timeout (mins): 60
    Include CSS: checked
    Standard sizes: checked

    The code I inserted into a page was this:

    I saved no presets as I think I will not need them yet.

    The output (which is showing me an error in the source code: )can be seen her: http://www.rum-reisen.de/reiseberichte/buenos-aires-bahia-blanca/ scroll down its at the bottom of the text saying: Und hier gehts zu der Slideshow:

    I tried this setting too:
    XSLT path: wp-content/plugins/dge-slideshow

    but it gave me the same problem…

  2. ovidiu Says:

    oops, a piece of code was cut out:

    The code I inserted into a page was this:

    ! slideshow ! ss1 ! http://www.rum-reisen.de/category/bahia-blanca-ushuaia/feed/ !

    here is the error code from the output:

  3. Dave Says:

    Try changing your inlinerss XSLT path to just ‘wp-content/plugins’. That’s what mine is. I’m off to bed now, so I’ll check back in the morning to see how you’re doing.

  4. Ovidiu Says:

    Hello Dave,

    I changed that setting, it seems to load now but shows no pictures?
    btw. could you also give me some hints where I can change the “formatting”? i.e. the size and format of the thumbs and of the big image, etc…

  5. Dave Says:

    If you look at the source of your page, it appears that something is filtering the quotes (") around the image hrefs in the javascript, turning them into fancy quotes (“ and ”). It’s weird because other parts of the slideshow’s output do not get modified. I’ve got an idea though, so hang in there…

  6. Dave Says:

    Try downloading the modified xslt again. I’ve modified it to properly escape the javascript in a CDATA section. Let’s hope this works.

    As far as formatting is concerned, it’s all modifiable with css. Look in the dge-slideshow plugin directory and you’ll find dge-slideshow.css. That does all the layout and colours etc. Take a copy of that and modify it to your heart’s content. At the moment, the scripting assumes a maximum of 5 thumbnails though, so you’d have to stick with that for now.

    Right, I’d better get some work done!

  7. Dave Says:

    No, wait, I’ve buggered it again. Hold on…

  8. Dave Says:

    That’s it now, I think. Swapped CDATA for good old html comment to hide the javascript from whatever’s filtering the quotes.

    I hope this sorts you out.

  9. Dave Says:

    Oh, and remember to clear out the cache, or set the timeout to 0.

  10. Ovidiu Says:

    ok, thx, works great for a first try: http://www.rum-reisen.de/reiseberichte/buenos-aires-bahia-blanca/ test here, also I already started playing around with the css file…

    still some more questions:

    a) why doesn’t the slideshow show all pictures from the feed?
    b) where does the slideshow take the thumbnails from? from my excerpt or from the content? because the excerpt contains landscape thumbnails while the content sometimes contains a portrait image… => it would be great if the slideshow took the thumbs out of the excerpt, because then I could show landscape thumbs instead of these square ones :-)

    thats it for now, all in all I am really happy with the outcome

  11. Ovidiu Says:

    sorry, my bad :-(

    I had to change these settings: wp admin => options => Reading => Syndication Feeds => Show the most recent: 10 postst.
    changed this to 999 most recent :-)

    It is 99% perfect right now, you can check out the link I gave above…

    2 little things are missing:

    a) when viewing an image in portrait mode, it is not centered…
    b) any chance to make a checkbox in the admin panel => check to autoplay slideshow and enter a default number of seconds between transitions?

    while a) is way more important right now :-)

    and again a big thank you for all your help, maybe some of my questions and comments will help you complete your documentation.
    you really helped me here, these friends wanted a slideshow and the gallery I chose for them does not allow for slideshows but has other strong points. so your plugin saved my ass ;-)

  12. Dave Says:

    Good to see you’ve got it working.

    What browser are you using? Portrait photos work for me. I’m on Firefox 1.5, and I have tested it on IE6 and it worked ok (that was a while ago though).

    I can’t do the auto play thingy any time soon. I move house tomorrow, so I’ll be sorting that out for a while.

  13. Dave Says:

    The centring problem is a css/javascript issue. Try replacing the dge-slideshow.js with the one I just checked in, revision 7093.

  14. Ovidiu Says:

    yes, the new dge-slideshow.js helped, portrait images are centered now too :-)

    you’re great, good luck moving house and if/when you come around to make other mods to the slideshow…. I am very interested too…

    I also had another idea what one can use this slideshow for but I am not sure it it is possible:

    I thought about using your slideshow for navigating a blog but then I remembered it can only cut out images from feeds, or can it cut whole content aprts out?
    I am thinking of brwosing a blog this way isntead of clicking on next post and previous post, this way is more fun and as it preloads the next feed in the background, a lot quicker…

    ###just a crazy idea of mine, you can safely ignore it###

    bye
    Ovidiu

  15. ovidiu Says:

    hello dave,

    any idea why the slideshow does not work “everywhere”?
    look here: http://www.rum-reisen.de/reiseberichte it works until entry number 14, number 15 does not work,….

    the respective entries I tried calling it with are:

    ! slideshow ! ss14 ! http://www.rum-reisen.de/category/14-buenos-aires/feed/ !

    ! slideshow ! ss15 ! http://www.rum-reisen.de/category/15-ba-anden-uruguay/feed/ !

    any ideas?

  16. Dave Says:

    Hello again, and happy new year.

    If I go to http://www.rum-reisen.de/category/15-ba-anden-uruguay/feed/ with my browser, I end up with an error message generated by my browser:

    XML Parsing Error: unclosed CDATA section
    Location: http://www.rum-reisen.de/category/15-ba-anden-uruguay/feed/
    Line Number 1423, Column 30: <content:encoded><![CDATA[

    The plugin could certainly be improved by failing more gracefully, but I think the problem’s with your site’s feed. There should be a cached version of the xml for you to look at (find it wherever you set up the cache directory in the inlinerss settings).

    Cheers,
    Dave.

  17. ovidiu Says:

    a happy new year to you too ;-)

    sorry for being so rude and having jumped straight to my problem.

    I had a look at the cached version, it said something about an error in another plugin (actually a plugin that created a nicer archive) saying its execution time exceeded 60 sec…

    I deactivated that plugin and took out the archive page, as they do not need that….

  18. Dave Says:

    Just so you know, with the next version (0.31), the xsl will change to be much simpler. The old one won’t work from version 0.31 and up. I’ve added a link to the new xsl in the main post.

    Cheers,
    Dave.

  19. Dave Says:

    The xsl mentioned in my last comment was wrong, so if you’ve downloaded it already, you’ll need this updated version. I’ve modified the link in the main post too.

    Incidentally, the latest version (0.31) implements an autoplay feature, a configurable delay between slides, and repeat funtionality. Try it with:

    ...blahblah...!play;delay=5000;repeat!

    Delay is milliseconds. Overkill I suppose, but there you go.

  20. don Says:

    Hi

    I am a complete and utter noob who is trying with next to no understanding to get this plugin to work for me. I get as far as a blank gallery appearing. I went to the cache directory I set up according to the instructions, and I find the document below.

    What does this mean? Does it suggest something obvious that I can look for? I’ve read through the comments and responses, but I don’t really understand them. I have installed v.0.93 of InlineRss and ver. 0.4 of DGEslideshow.

    I am hoping to be able to use this plug in to turn images from posts to a particular category on my website into a gallery of latest images posted. I believe I am running WP 2.2.3.

    Many, many thanks in advance for any advice!!!

    <!– DGE_SlideShow 0.4 –>

    first
    previous
    play
    pause
    next
    last
    maximise
    minimise

    <!– Horrific XSLT error - dge-ss-ss3 returned empty - verify that it’s a valid XML file and check logs. –>
    <!– Processed by DGE_InlineRSS 0.93 –>

    new DGE_Paginator(”ss-ss3″, {’play’:false,’repeat’:false,’delay’:4,’thumbs’:5});

    <!– end DGE_SlideShow –>

  21. Dave Says:

    Don,

    The problem sounds familiar, but I don’t have the code to hand to check out what’s going on. I will have a look hopefully before the end of the week.

    Cheers,
    Dave.

  22. don Says:

    heya Dave!

    I’ve set up a new WP blog using 2.3 to see if maybe that would work. No dice. I’m still making a mistake somewhere.

    Here’s a link to my first slideshow attempt which is supposed to draw images from a zooomr account I set up to test things with.

    Here’s a link to the post: http://www.rincon.realsurf.com/wp/?p=5
    And here’s a link to the contents of what I presume are the relevant pages in the cache directory I set up when installing inlineRSS so that I could use the slide show… http://www.rincon.realsurf.com/wp/?page_id=9

    I’m really hoping this is solvable because I think it is exactly what my site requires. Again, thanks for taking time to look into this.

  23. Dave Says:

    Don,

    I think I’ve cracked it. There’s a bug in the slideshow php code. You can work around it though by setting the preset on the Slideshow options page to ‘xslt=dge-slideshow/xsl/rssfeed.xsl’. Nothing else needs to go in there. The url should go in the !slideshow! call in your page or post.

    Cheers for spotting this. It’s now fixed properly so you shouldn’t need the workaround once the changes propagate to the download zip at wordpress.org/plugins.

    Dave.

  24. don Says:

    Many thanks for having a look Dave, but I still can’t get it to work…
    Please see http://www.rincon.realsurf.com/wp/?p=10 for the latest results (and settings I used) and a link to copies of the cache files. Again, thanks for taking the time to help!!!

  25. Louis Says:

    I’ve got the same problem with a FlickR feed

Leave a Reply