CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 List of Files In Directory

Print topic Send  topic

Author Message
rclayh
Posted: 05/17/2003, 6:31 PM

Is there a simple way, or a Code Charge Studio builder to display a list of files in a directory on a web site. I know this is non-standard but thought I would ask.
rclayh
Posted: 05/18/2003, 11:50 AM

It's actually pretty simple once you understand how CodeCharge works...

You need to add a Label control to the page where you want the list of files to appear.

Set the Label content to "HTML". Then in the Before Show event I added the following custom code:

$dh = opendir("./productphotos/");
while ($file = readdir ($dh))
{
if(substr($file,strpos($file,"."),4)== ".jpg")
{
$myimage = substr_replace($file,"_tn_tn.jpg",strpos($file,"."),4);
$filewords.="<a href='products_maint.php?image=$file'><img src='productphotos/thumbs/thumbs/$myimage' alt='$file'></a> ";
}
}
closedir ($dh);
$file_list->SetValue($filewords);

This basically goes through each file listed in the directory. If it's not a .jpg file it skips it. I then modified the $file name to display the thumbnail of the image and linked it to a maintenance page. So know I can call up a list of the images and click on the to create a new record in the database with the image field preloaded.

Actually pretty sweet and I found it in the documentation.
lneisius
Posted: 05/18/2003, 1:05 PM

rclayh:
Where at in the documentation?
rclayh
Posted: 05/18/2003, 4:46 PM

I found it under how to put Dynamic HTML on the page using a label.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.