My original code:
<?php
$dir="../zpress/pages"; // Directory where files are stored
if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
if(!is_dir($filename))
{
?>
<p><a href="../zpress/pages/<?php echo $filename; ?>"><?php echo $filename;
?></a></p>
<?php
}
closedir($dir_list);
}
?>
I also got some advice from a friend, and I created the code below, but it ends up just showing nothing on the page and I've not been able to troubleshoot it myself.
$the_files = array();
while(($filename = readdir($dir_list)) !== false) {
if(!is_dir($filename)) {
array_push($the_files,$filename);
}
}
sort($the_files);
foreach($the_files as $the_file) : ?>
<p><a href="../zpress/pages/<?php echo $filename; ?>"><?php echo $filename;?></a></p>
<?php endforeach; ?>

New Topic/Question
Reply




MultiQuote




|