Sorry, but your advice didn't help at all. 🙁
Anyway, when I place something like 'echo "this far it works";' -stuff after the while-clause, it still gets printed out. But if I place it after if-clause, it doesn't. So I thought that maybe there's something wrong with it then.
I got the initial code from this thread: ( by shawon22)
www.phpbuilder.com/board/showthread.php?s=&threadid=10228110&highlight=directory
I changed it a bit, as you can see. And at first it worked, though it printed out not the filenames as I expected, but the word 'Array' as many times as I had .shtml files in my directory. But anyway it recognized the right files (I had links pointing to those pages too).
So, any other suggestions?