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
    Oct 25, 2010 @ 16:34
    Sherry Ann Hernandez
    0

    Loop through a media folder and pass the value using javascript

    HI Guys,

    I have a module that when a user clicks the gallery tab it will only show a the gallery for a specific room.

    I use fancy box manual call to display the image. Using it I need to specify the image path to load it.

    This is the javascript code

     

    $(

     

    "#manual2").click(function() {

                 $.fancybox([

     

     

                     'http://farm5.static.flickr.com/4044/4286199901_33844563eb.jpg',

     

     

                     'http://farm3.static.flickr.com/2687/4220681515_cc4f42d6b9.jpg',

                                 {

     

     

                     'href' : 'http://farm5.static.flickr.com/4005/4213562882_851e92f326.jpg',

     

     

                     'title' : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit'

     

     

     

     

     

                               }

                            ], {

     

                  'padding'      : 0,

     

                  'transitionIn' : 'none',

                  'transitionOut' : 'none',

     

                  'type' : 'image',

     

                  'changeFade' : 0

     

     

                      });

    });

     

     

     

    In my xslt, I try to loop through a media folder and append each umbraco file with a delimited string. Then pass the delimited string to my javascript where I can have it split to get the path of each media item.

    This is my xslt code

    <li title="gallery" class="gallery">
        <a id="gallery" >                                   
            <xsl:attribute name="href">javascript: ImageGallery('
            <xsl:if test="gallery &gt; 0"> 
              <xsl:variable name="images" select="umbraco.library:GetMedia(gallery, 1)" />         
                <xsl:if test="count($images/*) &gt; 0">
                     <xsl:for-each select="$images/*">
                          <xsl:if test="./umbracoFile != ''">
                                  "{./umbracoFile}"| 
                          </xsl:if>      
                      </xsl:for-each> 
                </xsl:if> 
            </xsl:if> 
            ');</xsl:attribute>
            <xsl:attribute name="title"><xsl:value-of select="contentTitle"/> Gallery</xsl:attribute>
            Gallery
        </a>
    </li>

     

    But I can't even get the actual path using this and I dont know how can I append the umbraco file.

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Oct 26, 2010 @ 08:48
    Sebastiaan Janssen
    0

    Instead of 

    "{./umbracoFile}"| 

    Try:

    <xsl:text>"</xsl:text>
    <xsl:value-of select="./umbracoFile" />
    <xsl:text>"|

    If that doesn't work, what output DO you get?

  • 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