Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/07/2009, 16:35
maxitox11
 
Fecha de Ingreso: marzo-2009
Mensajes: 7
Antigüedad: 15 años, 2 meses
Puntos: 0
Respuesta: Download en PHP

Hola nuevamente, e encontrado este codigo:

<?php
// read all php file in the current directory
if ($dh = opendir('./')) {
$files = array();
while (($file = readdir($dh)) !== false) {
if (substr($file, strlen($file) - 4) == '.php') {
array_push($files, $file);
}
}
closedir($dh);
}

// Sort the files and display
sort($files);
echo "<ul>\n";
foreach ($files as $file) {
$title = Title($file);
echo "<li><a href=\"$file\" title=\"$title\">$title</a></li>\n";
}
echo "</ul>\n";

// Function to get a human readable title from the filename
function Title($filename) {
$title = substr($filename, 0, strlen($filename) - 4);
$title = str_replace('-', ' ', $title);
$title = ucwords($title);
return $title;
}
?>

y me anda a la perfeccion cuando lo pongo en un archivo .php pero si quiero que lo muestre en un html como hago?