How my php framework works

First off, some of this is ugly. I'm learning php, so I wouldn't say "I know php" yet. Secondly, I haven't figured out a nice way of doing some stuff yet. There may not even be a nice way of doing some of what I want to do.

Anyhow, I started out with these intentions:
-To make all my pages use a standard header, footer and sidebar. Then the entire appearance of my site can be changed by modifying upto three files (i.e. no requirement to modify every single page).
-To make the sidebar auto-generate. A new page exists in the sidebar by virtue of its existence.
-To learn some php.
-And last, but foremost, to make some pages that hopefully aren't dog-ugly, load pretty swiftly, and don't cause undue headaches for me, the person viewing the pages, or the sysadmin of the server upon which they sit.

A page template:


Each page is based on this template, which includes separate files for header, sidebar and footer. This is because these elements majorly define the look and feel of the website. The bulletttitle parameter is one which I have used to define the text which should be placed in the sidebar as a description of the page being linked to.

The header code:


Nothing special there really. Just note that the page is one big table, and the header is two cells on the top row.

The sidebar code:


The sidebar finds all files in the current directory which end in .php, and lists them in date order (this is driving me batty at the moment, every time I make a new file, I have to touch all the other files... I need to ls -1 -t -r to reverse the order, then the newest files will be last in the list.) Having stored this listing in a variable, it manipulates that slightly, and for each filename, tests it against the request URI to determine whether to display an illuminated LED picture or a dark LED. It creates a hyperlink to the filename, and displays the text from bullettitle as the visible link.

The footer code:


The only remarkable thing about the footer really is the last modified date. This returns automatically the last modified date of the requested page. Last modified dates are a good thing for determining the accuracy and current-ness of the information you're reading. What really infuriates me though is people who include a last modified date in their htm files, and then don't bother to edit it when they actually update the page. Giving me wrong information is worse than not giving me any information at all. I've been guilty of that one in the past.
LuaP logo

This page has been created by, and is maintained by Paul Norton. All content is Copyright Paul Norton 2002/2003 unless otherwise stated.
Comments, questions, notices etc should be sent to: luap@icculus.org
(Timezone: America/New York)