Hi i am trying to put together my first script.
It's supposed to read a directory for files containing a paired tag and echo the contents of the tag SORTED BY DATE-
well, both the functions are there on the net, but i can't put them together- all i get is error messages. Please help me!
Here are the two snippets of code i need to put together .
======================== parse for tag
<?
$dir = opendir(".");
while($f = readdir($dir))
{
if(stristr($f,".htm"))
{
$file = join("", file($f));
$date=date("m/d/y ", filemtime($f));
eregi("<title>(.*)</title>", $file, $title_array);
$fd="$date<a href='$f'>$title_array[1]</a><br>";
echo $fd;
}
}
?>
===================by date
$dir = opendir(".");
while($file=readdir($dir)){
if(!eregi("(.|..)$",$file)){
$time = filemtime($file);
$data[$time] = "<a
href=\"{server}/$file\">$file</a>".date( "F d
Y H:i:s",$time)."
";
}
}
krsort($data);
while(list($key,$val) = each($data)){
echo $val;
}
?>
thank you very much.