Hey guys, seriously going mad here, any help is appreciated.
I have a directory of .txt files. What I want is this.
I want to go through this directory and display it like something like this:
A
All files beginning with A
B
All files beginning with B
etc.
The letters will be in one div and the files in a seperate div.
This is what I have, bear with me, it's probably going in the wrong direction. Thanks to any and all contributions!
<?php
if ($handle = opendir('poems/')) {
while (false !== ($file = readdir($handle))) {
for ($i=65; $i<=90; $i++){
$n=chr($i);
echo '<div class="list">';
echo '<div class="large">';
echo chr($i);
echo '</div>';
if ($file != "." && $file != ".." && $file[0] == $n) {
echo '<div class="small"><div class="list2">';
echo "<a href=\"poems/$file\" class='nav'>$file</a><br />";
echo '</div>';
echo '</div>';
}
}
}
closedir($handle);
}
?>