471,571 Members | 3,811 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,571 software developers and data experts.

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.CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists(myFolderPath) Then
'The main picture folder exists
Set objPicturesFolder = objFSO.GetFolder(myFolderPath)
Set collPicturesFolders = objPicturesFolder.SubFolders
For Each indPicturesFolder in collPicturesFolders
indPicturesFolderSpaces =
Replace(indPicturesFolder.Name,"_"," ")
%>
<img src="icons/orangeball.gif" align="top">
<a href="thumb.asp?Folder=<%= indPicturesFolder.Name
%>" class="links">
<%= indPicturesFolderSpaces %></A>
<%
Next
%>
<%

Set collPicturesFolders = Nothing

Else
'The main picture folder does not exists
%>
<font class="error">No Pictures could be
found.</font>
<%
End If
%>
</td>
</tr>
</table>
Your help is kindly appreciated.
Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***
May 24 '06 #1
4 1421
Eugene Anthony wrote on 24 mei 2006 in
microsoft.public.inetserver.asp.general:
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?


Just count them:

page = 3
' starting at page 0 and each page has 10 files, but for the last page
n=0
For Each indPicturesFolder in collPicturesFolders
if n>=page*10 and n<=page*10+9 then
response.write indPicturesFolder.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)
May 24 '06 #2
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 ***
May 24 '06 #3
Eugene Anthony wrote on 24 mei 2006 in
microsoft.public.inetserver.asp.general:
Is there a way to store the names into a session variable, then using
the variable apply the paging style (next, previous).


What are you talking about?

Please quote what you are replying to. If you want to post a followup via
groups.google.com, 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/googlegroupsreply/>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
May 24 '06 #4

"Eugene Anthony" <so***********@yahoo.com> wrote in message
news:uS**************@TK2MSFTNGP05.phx.gbl...
Is there a way to store the names into a session variable, then using
the variable apply the paging style (next, previous).

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.documentElement.childNodes.length Then
lItemCount = xmlDOM.documentElement.childNodes.length - lStartIndex
End If

For i = lStartIndex To lStartIndex + lItemCount - 1
Set elem = xmlDOM.documentElement.childNodes(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.

Eugene Anthony

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

May 29 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Shawn | last post: by
2 posts views Thread by asad | last post: by
2 posts views Thread by rn5a | last post: by
5 posts views Thread by Donald Adams | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.