Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Page the contents of an Array?

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,49792
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Page the contents of an Array?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Page the contents of an Array? - 7/21/2007 3:39:05 PM   
  Louistar

 

Posts: 2
Score: 0
Joined: 7/21/2007
Status: offline
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 -- 7/21/2007 3:43:10 PM >
 
 
Post #: 1
 
 RE: Page the contents of an Array? - 7/23/2007 5:11:40 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
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

(in reply to Louistar)
 
 
Post #: 2
 
 RE: Page the contents of an Array? - 7/23/2007 5:34:13 AM   
  Louistar

 

Posts: 2
Score: 0
Joined: 7/21/2007
Status: offline
quote:

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.

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Page the contents of an Array? - 7/23/2007 6:07:32 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
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

(in reply to Louistar)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Page the contents of an Array? Page: [1]
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts