Hi,
Is there a way to make a PHP script that checks a folder on the webserver, and creates links for the html pages in the folder?
The reason for this question is that I have a system that creates webpages with statistics. One new for each month. Now I once a month have to update the statistics page manually.
Script for creating url's
Moderator: General Moderators
Re: Script for creating url's
You can read the files in a folder and print them into a list of links like...
Code: Select all
if ($handle = opendir('directory/')) {
echo "Files:<br />";
$i = 0;
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo $file;
echo "<br />";
$files_array[$i] = $file;
$i++;
}
}
foreach ($files_array as $value) {
echo '<a href="www.yoursite.com/directory/' . $value . '">' . $value . '</a><br />';
}
closedir($handle);
}