RE: [PHP] for() question
| From: | Greg Wiley | Date: | Tue, 29 Apr 2003 09:41:03 +0000 |
| Subject: | RE: [PHP] for() question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145612@lists.php.net to get a copy of this message | ||
Chris,
Is this what you really meant?
<?php
$dir_list = file("directories.txt");
$number_of_dirs = count($dir_list);
if (!$dir_list) {
print '<p>' . "\n" . '<strong>Directory File Not
Found.</strong>' .. "\n"
. '</p>';
exit;
}
print "\n" . '<table border="1"
bordercolor="navy">' . "\n";
print '<tr bgcolor="lightgrey">' . "\n";
print ' <td>Main Menu</td>' . "\n";
print '</tr>' . "\n\n";
for ($i = 0; $i < $number_of_dirs; $i++) {
//Get each line in text file and place in an array
$line = explode( "\t", $dir_list[$i]);
print '<tr>' . "\n";
for ($j = 0; $j < count($line); $j++) {
print ' <td>' . ($line[$j]) . '</td>' . "\n";
}
print '</tr>' . "\n\n";
}
print '</table>' . "\n";
It's difficult to know for sure as I'm only guessing at what the format of
directories.txt is and what the resultant table should look like.
Cheers, Greg.
> ----------------------------------------------
>
> This is probably just a small oversight on my behalf but it`s
> driving me closer to the bottle of Jack Daniels I have nearby.
>
> Thanks
> --
> Chris Blake
> Office : (011) 782-0840
> Cell : 083 985 0379
> Computers are a lot like air-conditioners.
> Once you open windows, they stop working properly.