Copied to clipboard

Flag this post as spam?

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


  • Anders Brohus 194 posts 475 karma points
    Jan 30, 2015 @ 11:15
    Anders Brohus
    0

    Image Gallery Problem

    Hi! :)

    I currently have an XSLT Image Gallery script

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
        version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library" xmlns:Examine="urn:Examine" 
        exclude-result-prefixes="msxml umbraco.library Examine ">
    
    
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    
        <xsl:param name="currentPage"/>
    
        <xsl:variable name="mediaFolderId" select="number($currentPage/mediaFolderId)" />
        <xsl:variable name="thumbWidth" select="number(256)" />
        <xsl:variable name="thumbHeight" select="number(170)" />
    
        <xsl:template match="/">
    
            <!-- Displays all images from a folder in the Media Library -->
    
            <xsl:if test="number($mediaFolderId)">
    
                <div id="Gallery">
                    <ul>
                        <xsl:for-each select="umbraco.library:GetMedia($mediaFolderId, true())/Image">
                            <xsl:if test="umbracoFile !=''">
                                <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">
                                    <a href="{umbracoFile}" title="{@nodeName}" rel="gallery">
                                        <img src="/imageGen.ashx?image={umbraco.library:UrlEncode(umbracoFile)}&amp;width={$thumbWidth}&amp;height={$thumbHeight}"  alt="{@nodeName}" title="{@nodeName}" class="thumbnail" />
                                    </a>
                                </li>
                            </xsl:if>
                        </xsl:for-each>
                    </ul>
                </div>
    
            </xsl:if>
    
        </xsl:template>   
    </xsl:stylesheet>
    

    But i would like to get paging on, so after 10 or 20 images it makes a new page, but i can't figure it out :/

    I don't know if it would be easier to make it an Partial View Macro?

    I just got this from a friend, but he don't know how to make paging on it xD

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 30, 2015 @ 11:52
    Dennis Aaen
    0

    Hi Anders,

    For the paging, in XSLT, I think that you should take a look on the pagination helper from Chriztian Steinmeier https://github.com/greystate/Greystate-XSLT-Helpers/tree/master/paginationhelper.

    Hope this helps,

    /Dennis

  • Anders Brohus 194 posts 475 karma points
    Feb 04, 2015 @ 14:54
    Anders Brohus
    0

    It don't need to be XSLT it could be Partial View Macro or Razor .. :)

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 04, 2015 @ 15:06
    Dennis Aaen
    0

    Hi Anders,

    Okay for an Razor Partial view, or Partial view marco example try to see this topic and especially this http://our.umbraco.org/forum/developers/razor/41166-Razor-Paging-snippet?p=0#comment153493 comment from Lee Kelleher, I think it could be a good starting point or actually a solution for you.

    Hope this helps,

    /Dennis

  • Anders Brohus 194 posts 475 karma points
    Feb 07, 2015 @ 10:59
    Anders Brohus
    0

    Thanks!...

    But it has to take items from an image folder, so fx after 20 images it makes a new "page"

Please Sign in or register to post replies

Write your reply to:

Draft