UQ Students should read the Disclaimer & Warning

Note: This page dates from 2005, and is kept for historical purposes.

How this site works

Templates | Comments | Working Code

Templates

Apache's URL rewriting engine, mod_rewrite, is used to send all URL's to an index.php file. This is the mod_rewrite used on this site.

The URL's are parsed by the PHP file, and split around any periods in the URL and stored in an array.

Care must always be taken to ensure that anything able to be externally passed into a file isn’t malicious. This function attempts to find PHP and HTML files, and returns a default PHP file if none are found. This can prevent anyone attempting to access anything unusual.

Files are stored as XHTML or XML. XHTML files are parsed for their body, style and title tags and these tags are then included into the resulting output. This allows a simple template system where the content can be created with any XHTML capable editor. I have found this to be the simplest way of creating a consistent and easily updateable style across a site.

There are several advantages and limitations to this approach.

Disadvantages include:

Advantages include:

Comments

This site uses an XSL based comments system.

PHP is used to run an XSL processor, as below. The comment, author and various other information is passed to this processor, which in turn applies a style sheet to it, producing an XML output file.

This is a slightly simplified version of the XSLT style sheet used to save comments.

A very similar process is used to display comments. PHP is once again used to run an XSLT processor, and the page information passed to that processor. Once again, an XSLT style sheet is applied to this information, using the previously stored XML comments file, and the output displayed in the browser.

This is a simplified version of the XSLT style sheet used to display comments.

Working Code

Update from the year 2011… Sadly, XSLT is annoying and not especially useful for anything particularly complex. I no longer use it, and have had to remove the below links.

Journal Site Code
Working examples of XSLT style sheets used in my journal can be viewed here.

Amused Site Code
Several examples of the working code used to generate my amused site are available.

Please remember that this code is © Copyright