[UPHPU] simple??? php function (display an index)
Saint Chaos
saintchaos at gmail.com
Wed Jul 19 12:28:40 MDT 2006
On 7/19/06, Lonnie Olson <fungus at aros.net> wrote:
> A better way to write the function would be:
> <?php
> function directory($directory='.') {
> print "<ul>\n";
> $handle = opendir($directory);
> while ($file = readdir($handle)) {
> if ($file != '.' && $file != '..') {
> print "<li><a href=\"$directory/$file\">$file</a></li>\n";
> }
> }
> closedir($handle);
> print "</ul>";
> }
> ?>
>
> This function uses a list for markup (easier to style), and allows
> you to pass in a directory name.
>
> --lonnie
>
>
>
>
That is a much nicer way to do it. I just through the other as a quick
example of how to do it, didn't really look to deeply into what it did. :)
--
>From the ashes shall rise a new age. An age without rules, without laws and
without men.
More information about the UPHPU
mailing list