Ik lees een dir in met onderstaand script. Waarom krijg ik eerst de dir Instellingen en pas daarna Beheerders?
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| <?php function showModules(){ if ($handle = opendir(MODULES_SERVER_PATH)){ $return .= "\n<ul id=\"nav\">\n"; while (false !== ($file = readdir($handle))){ $datafile = MODULES_SERVER_PATH . "/" . $file . "/data.php"; $indexpath = MODULES_SERVER_PATH . "/" . $file; $webindexfile = MODULES_PATH . "/" . $file . "/index.php"; if($file != "." && $file != ".." && file_exists($datafile)){ unset($mod_name, $mod_desc, $mod_sub); include($datafile); $return .= "\t<li><a href=\"" . $webindexfile . "\" title='$mod_desc'>$mod_name</a>\n"; if(isset($mod_sub) && is_array($mod_sub)){ $return .= "\t\t<ul>\n"; foreach($mod_sub as $sub){ $return .= "\t\t\t<li><a href='" . MODULES_PATH . "/" . $file . "/" . $sub['link'] . "'>" . $sub['title'] . "</a></li>\n"; } $return .= "\t\t</ul>\n"; } $return .= "\t</li>\n"; } } closedir($handle); $return .= "</ul>\n"; } if(!$return){ $return = "Geen modules geinstalleerd."; } return $return; } ?> |