stripping extensions
Posted: Fri Jun 25, 2004 12:39 am
hello again,
im looking to readdir and echo the contents onto my main page like so:
as you may see, this code will echo the exact contents, including the .htm extension... the contents represent the users who have joined my community, and I would like for the users names to be echoed on the page how it is now, but without the .htm extention... how would I incorporate that idea within the syntax of my script above?
thanks in advance...
im looking to readdir and echo the contents onto my main page like so:
Code: Select all
<?
$the_array = Array();
$handle = opendir('user/');
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$the_arrayї] = $file;
}
}
closedir($handle);
sort ($the_array);
reset ($the_array);
while (list ($key, $val) = each ($the_array)) {
echo "<div style='border:#EFEFEF 1px solid;width:100;'>";
echo "<center><a href='http://munday.t35.com/user/".$val."' style='text-decoration:none'><font color='#FFFFFF'>".$val."</font></a></center>";
echo "</div>";
}
?>thanks in advance...