Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sherry Ann Hernandez 320 posts 344 karma points
    Jun 26, 2011 @ 08:30
    Sherry Ann Hernandez
    0

    Loop through media contents using xslt

    Hi,

    In my media section I have this setup.

    Hotel 1

       - Rooms - (Folder)

            - Room Type 1 (Folder)

               - Images (Folder) -> This the folder name where we upload all the images.

            - Room Type 2

               - Images

     

    And then on my content I wanted to select the "Rooms" folder to display all the images under it which means just using the "images" folder to display all the medias inside it. Any ideas how to do it?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 26, 2011 @ 11:35
    Dennis Aaen
    1

    Hi Sherry,

    I've found a page of Umbraco´s Wiki that describes, how to get images from a specific folder in the media section.

    http://our.umbraco.org/wiki/how-tos/xslt-useful-tips-and-snippets/list-images-from-mediafolder-in-umbraco-45-plus

    Hope this can be very helpful to find a solution.

    /Dennis

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jun 26, 2011 @ 12:00
    Kim Andersen
    0

    Hi Sherry Ann

    The wiki entry that Dennis' links to shows you a great xample of how you should be able to achieve what you're after. Just be aware that the example shows you how to create some kind of a gallery where you can click the thumbnails (created using ImageGen), and then see the full size image. If you don't need this function you can just remove some lines of code in the xslt shown :)

    /Kim A

  • Sherry Ann Hernandez 320 posts 344 karma points
    Jun 26, 2011 @ 12:16
    Sherry Ann Hernandez
    0

    But then if I select the rooms folder, all that is showing is all the room type folder but I need to go down one more level to show all the images. I was thinking of there is an automatic way of checking if there are images in this folder and then if not go to next level folder to check it?

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jun 26, 2011 @ 14:02
    Kim Andersen
    0

    Hi again Sherry

    So you want to be able to select the Rooms-folder, and then show all of the images in every folder lying below that folder, is that correct?

    If that's the case and we don't know how many folders and levels we're having under the Rooms-folder, try changng the for-each to this:

    <xsl:for-eachselect="$mediaItems//Image">

    The change is an extra /, which will traverse down the entire tree. Does this make a difference?

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft