paging folders

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eugene Anthony

    paging folders

    The code bellow will display a list of folders in a directory. Now lets
    say I have 20 folders, I want to display the first 10 folders, then
    display another 10 folders just like the paging concept how is it done?


    <table cellpadding="3" cellspacing="0" border="0" width="420">
    <tr>
    <td width="120"> </td>
    <td width="300">

    <%
    Set objFSO =
    Server.CreateOb ject("Scripting .FileSystemObje ct")

    If objFSO.FolderEx ists(myFolderPa th) Then
    'The main picture folder exists
    Set objPicturesFold er = objFSO.GetFolde r(myFolderPath)
    Set collPicturesFol ders = objPicturesFold er.SubFolders
    For Each indPicturesFold er in collPicturesFol ders
    indPicturesFold erSpaces =
    Replace(indPict uresFolder.Name ,"_"," ")
    %>
    <img src="icons/orangeball.gif" align="top">
    <a href="thumb.asp ?Folder=<%= indPicturesFold er.Name
    %>" class="links">
    <%= indPicturesFold erSpaces %></A>


    <%
    Next
    %>
    <%

    Set collPicturesFol ders = Nothing

    Else
    'The main picture folder does not exists
    %>
    <font class="error">N o Pictures could be
    found.</font>
    <%
    End If
    %>
    </td>
    </tr>
    </table>


    Your help is kindly appreciated.


    Eugene Anthony

    *** Sent via Developersdex http://www.developersdex.com ***
  • Evertjan.

    #2
    Re: paging folders

    Eugene Anthony wrote on 24 mei 2006 in
    microsoft.publi c.inetserver.as p.general:
    [color=blue]
    > The code bellow will display a list of folders in a directory. Now lets
    > say I have 20 folders, I want to display the first 10 folders, then
    > display another 10 folders just like the paging concept how is it done?
    >[/color]

    Just count them:

    page = 3
    ' starting at page 0 and each page has 10 files, but for the last page
    n=0
    For Each indPicturesFold er in collPicturesFol ders
    if n>=page*10 and n<=page*10+9 then
    response.write indPicturesFold er.Name & "<br>"
    end if
    n=n+1
    next

    This is basic vbs, but untested


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • Eugene Anthony

      #3
      Re: paging folders

      Is there a way to store the names into a session variable, then using
      the variable apply the paging style (next, previous).

      Eugene Anthony

      *** Sent via Developersdex http://www.developersdex.com ***

      Comment

      • Evertjan.

        #4
        Re: paging folders

        Eugene Anthony wrote on 24 mei 2006 in
        microsoft.publi c.inetserver.as p.general:
        [color=blue]
        > Is there a way to store the names into a session variable, then using
        > the variable apply the paging style (next, previous).[/color]

        What are you talking about?

        Please quote what you are replying to. If you want to post a followup via
        groups.google.c om, don't use the "Reply" link at the bottom of the article.
        Click on "show options" at the top of the article, then click on the
        "Reply" at the bottom of the article headers.
        <http://www.safalra.com/special/googlegroupsrep ly/>

        --
        Evertjan.
        The Netherlands.
        (Please change the x'es to dots in my emailaddress)

        Comment

        • Anthony Jones

          #5
          Re: paging folders


          "Eugene Anthony" <solomon_13000@ yahoo.com> wrote in message
          news:uSbkij1fGH A.3456@TK2MSFTN GP05.phx.gbl...[color=blue]
          > Is there a way to store the names into a session variable, then using
          > the variable apply the paging style (next, previous).
          >[/color]

          There is but I'm not sure that level of complexity is required for just 20
          folders. However assuming you have a lot more in a real world situation and
          after some performance testing you can see that all the FSO activity would
          cause the app a problem, then as an outline this is what I would do:-

          Create function which builds an XML representation of the folders into a
          Free Threaded DOM. Store the DOM in the Session object. Have page accept a
          startIndex and itemCount query string values to specify the items needed.
          The output can then access the appropriate items using syntax like this:-

          If lItemCount + lStartndex > xmlDOM.document Element.childNo des.length Then
          lItemCount = xmlDOM.document Element.childNo des.length - lStartIndex
          End If

          For i = lStartIndex To lStartIndex + lItemCount - 1
          Set elem = xmlDOM.document Element.childNo des(i)
          ' Write HTML to Response
          Next

          This should preform reasonably well. You could consider storing the XML in
          the application object if the list is quite static and is useful to multiple
          users. However in both cases you might also need to mechanism to drop them
          from the application or session object when not needed.



          [color=blue]
          > Eugene Anthony
          >
          > *** Sent via Developersdex http://www.developersdex.com ***[/color]


          Comment

          Working...