Skip navigation.

Harold's Home

   Home
  
XML version of this site

PHP Scripts

Index
CLI fun
Mail on 404
HB-NS (NewsScript)

Downloads

Applescripts
APOD to Desktop
Dreamweaver Extensions

Stuff

Writings
Other stuff
Central Grinder

OOOk Default:

VJ stuff
VJ Tools
Bananas
Strippers
Sample Movies

News

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:
listing.php

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