The key to making this all work properly is the folder recursion. The primary issue is when creating unique ID names used in the <div></div> tags so that the Javascript showing and hiding of the sub-folders works properly. This is accomplished by using a simple increasing integer counter that will be used as part of the ID name.
In the example the starting folder for recursion is set in the constant "basePath". You can define this variable with any valid sub-folder under your web root. Do not use physical path names (e.g. c:\inetpub\www_root\images), because this routine uses Server.MapPath to grab the correct physical path from the virtual folder name (e.g. /images).
Lastly, since you typically would not want to show any of the folders automatically created by FrontPage server extensions (if they are installed on your server), I include a boolean variable "hideFrontPage" with a default of True. If you want to show all folders including the ones created by FrontPage, set this value to False.
I Hope you found this helpful. Comments can be sent to Andrew@dotNetBB.com.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |