Hello Jeremiah,

There is a variety of options to list files in a directory.
This will list sort files by date.

<?

$dir = opendir(".");
while($file=readdir($dir)){
if(!eregi("^(.|..)$",$file)){
$time = filemtime($file);
$data[$time] = "<a
href=\"{server}/$file\">$file</a><br/>".date( "F d
Y H:i:s",$time)."
";
}
}
krsort($data);
while(list($key,$val) = each($data)){
echo $val;
}

?>

This one gets a tag out of a document
<?
        $dir = opendir(".");
        while($f = readdir($dir))
        {
                if(eregi(".html$", $f)){

                        $file = join("", file($f));

                         $date=date("m/d/y ", filemtime($f));

                        eregi("<title>(.*)</title>", $file, $title_array);

                        $fd="$date<a href='$sd'>$title_array[1]</a><br\>";
                        echo $fd;



                }

        }

        ?>

        The actual script is very small- this is the basic snippet
        from the manual  for readdir.
        
<?php
$handle = opendir('.'); 
while (false !== ($file = readdir($handle))) { 
    if ($file != "." && $file != "..") { 
        echo "$file\n"; 
    } 
}
closedir($handle); 
?>


Hope this helps.
I am just starting out in this- anybody know how to combine a list by
date with the parser, so that a script will display titles of html
files sorted by latest document first? i can't seem to get the two
arrays to work together,silly as it sounds. Someone help!

        
Thank's to Dina for sharing this with me- and she says it ways guys on
the #php irc channel that helped her out...

There are some sample scripts in the php manual and the comments in
the online documentation.
Sorry guys, i keep these snippets in one file, so i don't know who
wrote what. Don't get all upset now, it's not like i am using this for
my benefit ;0

Monday, December 17, 2001, 5:55:48 PM, you wrote:

JJ> Anyone have a php directory listing script that creates clickable links for
JJ> all items in folder list?

JJ> JJ





-- 
Best regards,
 php                            mailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to