Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Apr 13, 2012 @ 21:12
    Fuji Kusaka
    0

    Cant get number of file for paging to work

     Hi there,

    Can someone point out how to get the number of file from a media folder when using a media picker??..

    Am trying to make paging but doesnt seem to work.

    <xsl:variable name="picker" select="$currentPage/docs"/>
    <xsl:variable name="itemsToDisplay" select="2"/> 
    <xsl:variable name="numberOfItems" select="count($picker/*[@id])"/> 
    <xsl:variable name="jump" select="$itemsToDisplay * $pageNumber +1" />
    <!-- -->
     <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
        <xsl:sort select="@createDate" order="descending" />
        
             <xsl:if test="position() &lt; $jump and position() &gt;= ($jump - $itemsToDisplay)">

     

    Any suggestion on the counting of file??What am i doing wrong here

  • Dan 1250 posts 3747 karma points admin c-trib
    Apr 14, 2012 @ 09:27
    Dan
    0

    Hi Fuji,

    There's a wiki article on how to list all files in a media folder.  It doesn't do the count stuff, but should be pretty easy to modify.

    I think the main thing you'd want to do would be to get your count variable, something like this (not tested it!):

    <xsl:variablename="numberOfItems"select="count(umbraco.library:GetMedia($mediafolder, true()))"/>

    Hope this points you in the right direction...

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Apr 14, 2012 @ 12:37
    Chriztian Steinmeier
    0

    Hi Fuji,

    Is the docs property a standard Media Picker? If so, remember it only stores the Id so you'll need to use the GetMedia() extension (I'm sure you know that). If it's a DAMP picker you'll need to examine the XML a bit closer to see which items you actually need to count... (seem to remember they're stored as <mediaItem> nodes or similar).

    /Chriztian

  • Fuji Kusaka 2203 posts 4220 karma points
    Apr 14, 2012 @ 20:39
    Fuji Kusaka
    0

    Hi Chrizrtian,

    Yes its a normal Media Picker, am actually getting all the files , but not getting the paging to work.

    <xsl:variable name="picker" select="$currentPage/viewDocuments"/>
    <xsl:variable name="itemsToDisplay" select="5"/> 
    <xsl:variable name="jump" select="$itemsToDisplay * $pageNumber +1" />
     
    <xsl:if test="$mediapickerproperty &gt; 0"> 
        <xsl:variable name="mediaItems" select="umbraco.library:GetMedia($picker, 1)" />    
        <xsl:variable name="numberOfItems" select="count($mediaItems/*[@id])"/>
       
        <xsl:for-each select="$mediaItems/Pdf"> ...\
         </xsl:for-each> 
  • Fuji Kusaka 2203 posts 4220 karma points
    Apr 24, 2012 @ 08:54
    Fuji Kusaka
    0

    Hi Chriztian,

    This is how i sorted it out. 

     <xsl:variable name="picker" select="$currentPage/viewDocuments"/>    
    <xsl:variable name="itemsToDisplay" select="10"/>     
    <xsl:variable name="jump" select="$itemsToDisplay * $pageNumber +1" />

        <xsl:variable name="numberOfItems">
              <xsl:if test="$picker &gt; 0">
            <xsl:value-of select="count(umbraco.library:GetMedia($picker,1)/Pdf)"/>
        </xsl:if>  
        </xsl:variable>

     

    //fuji

  • 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