hallo,

dit script:
----
<?
// This is the directory to list files for.
$theDirectory = "dir"; //default: .

//own scandir
$dir = $theDirectory;
$dirlist = scandir($dir);

//print_r($dirlist);

echo "<table><tr><td>type</td><td>name</td><td>dir</td></tr>";
echo "<tr><td colspan='3'align='right'style='color: #FF0000;'>alles</td></tr>";

foreach ($dirlist as $hit){
$type = filetype($hit);
$path = realpath($hit);

echo "<tr>";
echo "<td>".$type."</td>";
echo "<td>".$hit."</td>";
echo "<td>".$path."</td>";
echo "</tr>";
}
echo "<tr><td colspan='3'align='right'style='color: #FF0000;'>alleen dirs</td></tr>";

foreach ($dirlist as $dir){
if (filetype($dir) == 'dir'){
echo "<tr><td>map</td><td>".$dir."</td><td>n.v.t.</td></tr>";
if (($dir !== ".") and ($dir !== "..")){
//echo "<tr><td colspan='3'>vervolg<td></tr>";
$subdirlist = scandir($dir);

foreach ($subdirlist as $subhit){
$subtype = filetype($subhit);
$subpath = realpath($subhit);

echo "<tr>";
echo "<td>".$subtype."</td>";
echo "<td>".$subhit."</td>";
echo "<td>".$subpath."</td>";
echo "</tr>";
}
}
}
}
echo ("</table>");
?>
----
herkent de dir dir_twee niet als dir. wat doe ik fout online voorbeeld --> (http://test.steunpunt.nexethosting.com/)

wie helpt mij?

Ivar

P.S. zijn er ook bb/html tags om een link te maken. (hier op het forum dus)
[php]is_dir()[/php].
Voor je PS zie de FAQ.
nu heb ik dit:


<?
error_reporting(E_ALL);

// This is the directory to list files for.
$theDirectory = "dir"; //default: .

//own scandir
$dir = $theDirectory;
$dirlist = scandir($dir);

//print_r($dirlist);

echo "<table><tr><td>type</td><td>name</td><td>dir</td></tr>";
echo "<tr><td colspan='3'align='right'style='color: #FF0000;'>alles</td></tr>";

foreach ($dirlist as $hit){
    //$type = filetype($hit);
		$type = "file";
		$pretype = is_dir($hit);
		if ($pretype == TRUE){$type = "dir";}
		$path = realpath($hit);
		
	  echo "<tr>";
		echo "<td>".$type."</td>";
		echo "<td>".$hit."</td>";
		echo "<td>".$path."</td>";
		echo "</tr>";
		
}
echo "<tr><td colspan='3'align='right'style='color: #FF0000;'>alleen dirs</td></tr>";

foreach ($dirlist as $dir){
    //if (filetype($dir) == 'dir'){
		if ($type == "dir"){
		    echo "<tr><td>map</td><td>".$dir."</td><td>n.v.t.</td></tr>";
				if (($dir !== ".") and ($dir !== "..")){
				//echo "<tr><td colspan='3'>vervolg<td></tr>";
				    $subdirlist = scandir($dir);
						
						foreach ($subdirlist as $subhit){
    						  //$subtype = filetype($subhit);
									$subtype = "file";
								  $presubtype = is_dir($hit);
		              if ($presubtype == TRUE){$type = "dir";}
									
									$subpath = realpath($subhit);
		
	  							echo "<tr>";
									echo "<td>".$subtype."</td>";
									echo "<td>".$subhit."</td>";
									echo "<td>".$subpath."</td>";
  								echo "</tr>";
						}						
				}
		}
}
echo ("</table>");
?>


maar zie hier het werkt niet.

Reageren