Copied to clipboard

Flag this post as spam?

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


  • Bogice 6 posts 27 karma points
    May 25, 2011 @ 21:26
    Bogice
    0

    how would i retrieve every images under Image folder in Media section

    Hi,

    I am trying to loop through an Image folder to render out every images under this folder. I am using new schema 4.5.2. A code snipet would be much appriciated

    Thank you

     

  • John C Scott 457 posts 1157 karma points
    May 25, 2011 @ 21:59
    John C Scott
    0

    It would be good to better understand how you have set this up.

    Is this in a media section? Are you looking to have a media picker that picks the media folder and then list every image in that folder. When you say under that folder will there be sub-folders too?

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    May 25, 2011 @ 22:01
    Dennis Aaen
    0

    Hi Bogice,

    I found this page on the Umbraco wiki.

    With this code, you should be able to list images from a mediefolder 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 it will helps you to solved your question

    /Dennis

  • Bogice 6 posts 27 karma points
    May 25, 2011 @ 22:04
    Bogice
    0

    Thank you for your fast respond Scott,

    Yes it is in media section as the title of the topic say. Basicly i am only try to show every images under Image/MyRolloverImages for rollover feeding. There will be no subfolder. i've create Image/MyRolloverImages folder and it has id = 1685.

     

  • Bogice 6 posts 27 karma points
    May 25, 2011 @ 22:22
    Bogice
    1

    Thank you guys, i have figure it out, this is how i did for other's reference

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <xsl:variable name="ri" select="umbraco.library:GetMedia(1685, true())" />
      <div id ="slider">  
          <xsl:for-each select="$ri/*">
            <xsl:if test="./@id">
              <xsl:variable name="m" select="umbraco.library:GetMedia(./@id, false())"></xsl:variable>
               <img src="{$m/umbracoFile}" alt="" />
            </xsl:if>
          </xsl:for-each>
       </div>
    </xsl:template>

    </xsl:stylesheet>

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies