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

 Fil listbox with list of files (opendir) in php

Print topic Send  topic

Author Message
Webracer
Posted: 07/15/2003, 3:37 AM

I tried to fill up a listbox in CCS. Most is working fine but I always get only one file in my listbox. Can someone help me out?

global $NewRecord1;
//define the path as relative
$path = "images/";
$dummy = 1;
//using the opendir function
$dir_handle = @opendir($path) or die("Directory $path not found");

$files["$file"] = array();
//running the while loop
while ($file = readdir($dir_handle))
{ if($file != '.' && $file != '..')
$files[$dummy] = $file;
$dummy = $dummy + 1;
}
//closing the directory
closedir($dir_handle);
$NewRecord1->ListBox2->Values = array(array_values($files));
Headhunter
Posted: 07/15/2003, 2:16 PM

look at this article:
http://www.gotocode.com/art.asp?art_id=241&

I used this in my project (CCS2 + php + MySQL), and code looks like this:

global $settings;
$theme2=$settings->theme->GetValue();
$default_dir = "Themes/";//Dir path You want to list
$settings->theme_dir->SetValue("<select name=\"file2\" onchange=\"updateThemeField()\">");
$settings->theme_dir->SetValue($settings->theme_dir->GetValue() . "<option SELECTED value=\"" . $theme2 . "\">" . $theme2 );
if(!($handle = opendir($default_dir))) die("Cannot open $default_dir.");
while(false !== ($file = readdir($handle)))
{
if($file != '.' && $file != '..')
{
$settings->theme_dir->SetValue($settings->theme_dir->GetValue()
. "<option value=\"" . $file . "\">" . $file
);

}
}
closedir($handle);
$settings->theme_dir->SetValue($settings->theme_dir->GetValue() . "</select>");

echo'
<script language="JavaScript">
function updateThemeField() {
var v = document.settings.file2.selectedIndex;
var x = document.settings.file2[v].value;
document.settings.theme.value=x;
}
</script>';

Webracer
Posted: 07/16/2003, 3:45 AM

Headhunter,

I tried your code but I do something wrong. Is it possible to send a simple CCS-project as example toinfo@c21.be ?

   


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

MS Access to Web

Convert MS Access to Web.
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.