Page the contents of an Array?

Author Message
Louistar

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 7/21/2007
  • Status: offline
Page the contents of an Array? Saturday, July 21, 2007 4:39 PM (permalink)
0
Hi everyone,

I would like to divide the contents of an array into different pages, but can't seem to figure out how it is done.

Here is a simple outline of what my script is supposed to do:

1) Read video files from a folder
2) Determine number of files and their names
3) Remove file extension from all names
4) Put all file names into a string, separating the file names with || (double pipe)
5) Using the double pipe, divide the contents of the string into an array
6) Display x number of files per page, with each file hyper-linked
7) Display "previous" and "next" page links and a link for each set of x number of files (for example: Previous Page | Page 1 | Page 2 | Page 3 | Next Page )
8) All of the above must be created on the fly, on one page called default.asp, using QueryString passing.

So, I'm able to accomplish everything up to #5, but after that, I have no idea how to divide the Array in such a way that it will only display x number of files in the folder. I'm able to display all files on one page, that's no problem, but I can't seem to wrap my mind around the process of "paginating" or "paging" the contents of the Array, similar to the way database information is divided into "pages". Keep in mind that the application will not have definite numbers to use, but must be able to "page" the results, no matter how many files are in the folder, as it will always be different.

I obviously don't expect anyone to code this out for me, but maybe just point me in the right direction regarding concepts or ideas, then maybe I can code it from there.

Thank you in advance for any help,

Louis.
<message edited by Louistar on Saturday, July 21, 2007 4:43 PM>
 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    RE: Page the contents of an Array? Monday, July 23, 2007 6:11 AM (permalink)
    0
    To split into an array, look at the WSH documentation for the Split() function.
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      Louistar

      • Total Posts : 2
      • Scores: 0
      • Reward points : 0
      • Joined: 7/21/2007
      • Status: offline
      RE: Page the contents of an Array? Monday, July 23, 2007 6:34 AM (permalink)
      0

      ORIGINAL: ebgreen

      To split into an array, look at the WSH documentation for the Split() function.

      Actually, I have no problem using the split function to populate an array. The problem lies in dividing up an already-populated array into separate pages, as opposed to just displaying the entire contents of the array at once. Similar to how you would divide a database query into pages.
       
      Thanks, let me know if you have any other suggestions.
       
      Louis.
       
      #3
        ebgreen

        • Total Posts : 8227
        • Scores: 98
        • Reward points : 0
        • Joined: 7/12/2005
        • Status: offline
        RE: Page the contents of an Array? Monday, July 23, 2007 7:07 AM (permalink)
        0
        In that case it sounds like you are having problems with number 6 not number 5. It isn't really that difficult to display the data in pages. Just decide how many rows on a page you want to display then do it the exact same way that you would display the whole thing only set the start and stop number of the for loop that iterates through the array contents based on the page number that you want to display.
        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
        http://www.visualbasicscript.com/m_47117/tm.htm
         
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9