displaying directories problem
Posted: Sat Dec 02, 2006 11:17 am
I have three folders in my "www" directory I cannot get to show from my php file.
I am trying to display them from a file located in "C:/wamp/www/wamp5/index.php".
If I don't ignore "." and ".." then "." and ".." are displayed as that.
If I do ignore . and .. then it echos this:
No project yet.
To create a new one, just create a directory in 'www'.
Which is called from a variable on another part of the page.
Any help would be great.
Edit: if I place this file in the actual www folder (where I dont need it) and remove "$dir = "C:/wamp/www/";" and change $handle=opendir(.); it displays the folders.
I am trying to display them from a file located in "C:/wamp/www/wamp5/index.php".
If I don't ignore "." and ".." then "." and ".." are displayed as that.
If I do ignore . and .. then it echos this:
No project yet.
To create a new one, just create a directory in 'www'.
Which is called from a variable on another part of the page.
Code: Select all
<?php
$list_ignore = array ('.','..','test_perl','exemples','phpmyadmin','sqlitemanager');
$dir = "C:/wamp/www/";
$handle=opendir($dir);
$msg = $langues[$langue]['txt_no_projet'];
while ($file = readdir($handle)) {
if (is_dir($file) && !in_array($file,$list_ignore)) {
$msg = '';
echo '<a class="ditem" href="'.$file.'"><img src="dossier.gif" alt="image dossier" /> '.$file.'</a>';
}
}
closedir($handle);
echo $msg;
?>Any help would be great.
Edit: if I place this file in the actual www folder (where I dont need it) and remove "$dir = "C:/wamp/www/";" and change $handle=opendir(.); it displays the folders.