Skip navigation.

Harold's Home

XML version of this site

PHP Scripts

CLI fun
Mail on 404
HB-NS (NewsScript)


APOD to Desktop
Dreamweaver Extensions


Other stuff
Central Grinder

OOOk Default:

VJ stuff
VJ Tools
Sample Movies


Two useful PHP tricks
I got a complaint recently that most of my website is turning out to be about Macintosh stuff and that I'm leaving the poor people who are stuck with Windows behind.

So here's a PHP script* I've written that demonstrates two pretty useful principles, both of these are adaptations on code that's floating around the web but that just didn't quite perform up to my standards, that I needed this week. So I modified it a bit and here it is for your enjoyment.

The problem:
How to print the current directorylisting (with links to all the files) in a nicely formatted table.
As an added bonus the files and the directories should be separated from each other.

The solution:

The above link demonstrates the output and includes the code of listing.phps, the source of the listing.
Confused? Just holler in the comments!

*) Yes, I know, there aren't that many people running PHP on Windows (and why should they) so this could probably be construed as yet another non-Windows thingy. Live with it people, the code works on any practically platform that has PHP installed and is tested on Mac OS X and various *nix systems (four to be exact).

Show all items | Read all items

About, copyright, privacy and accessibility | Mail