English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i have solved this problem i need to put a special icon for each type of file how i must do it?i did it for directory






echo "

";
echo "";
echo "";
echo "
";


$d=opendir($_REQUEST[dirname]);






while ( ($str=readdir($d))!=NULL ) {


if ( is_dir("$_REQUEST[dirname]".$str) ) { echo " $str";}




echo "
";
}








closedir($d);
?>

2006-11-19 06:49:00 · 1 answers · asked by Anonymous in Computers & Internet Programming & Design

1 answers

you need to split the string to grab the string to the right of the dot in the file name. use a generic image for the file extensions you are not interested in and a image of your choice for the file extensions that you are interested in.....

Your best bet is a run-time 2 dimensional array which is filled from a file which will contain the extension and the matching image based on the same array element. With a file controlled array, you can change and update it at any time without changing the program itself....and save yourself some headaches later from a maintenance standpoint.

If you don't have a match in the array, default to a generic image, otherwise use the one specified in the array

2006-11-19 08:36:50 · answer #1 · answered by Jeffrey F 6 · 0 0

fedest.com, questions and answers