Here's my code:
Code:
<html>
<head>
<title>Dir Test</title>
</head>
<body>
<p>
<?
$dir = 'test';
$pages = scandir($dir, 1);
?>
<table>
<!-- Headers -->
<tr><td><b>Name</b></td><td><b>Type</b></td><td><b>Link</b></td><td><b>is_file</b></td></tr>
<?
for ($i = 0; $i <= sizeof($pages)-3; $i++)
{
$name = substr($pages[$i], 0, strrpos($pages[$i], "."));
$type = substr($pages[$i], strrpos($pages[$i], ".")+1);
$link = "<a href=/php/view-text.php?section=".$_GET['section']."&page=".$name.">".$name."</a>";
$type = var_dump(is_file($pages[$i]));
echo "<tr><td>".$name."</td>".
"<td>".$type."</td>".
"<td>".$link."</td>".
"<td>".$type;?></td></tr><?
}
?>
</table>
</p>
</body>
</html>
My problem is that no matter what I do:
1. The is_file always returns false, even though I know that those are files, and that they exist. Even though the scandir thinks they are!!
2. When I print the result from var_dump(is_file()), it prints outside of the table (above it in a end-to-end list, as a matter of fact), no matter if I do an "echo $type.</td></tr>" or have it outside the php "echo $type;?></td></tr><?". If I remove the </td></tr> stuff, then I get them inside the table, but they're shifted up one cell....
I'm probably just missing something silly though...