this is not a blog

I Reckon This Must be the Place, I Reckon

Details of the architecture

There Are Rules Here

This site operates through "rules" defined in an INI encoded file, RULES.INI. Here is an excerpt:

        default = read
        displayhtml open
        displayhtml close
        displayhtml open
        displayhtml close

A "rule" is simply ?rule in the URL. (Internally a rule is known as op, actually converted to $_GET['op'].)

The end of INDEX.PHP reads the $_GET variable which is then handed off to the function that runs the site:

PHP code $op getvar('op');

The function getvar() replaces the assignment "is set GET variable ? GET variable : null", which may seem odd but it reduces over all code size and complexity (something that is fun to do).

A rule is made up of functions. A rule of:


would run the PHP function phpinfo() and exit with a URL of ?phpinfo. (And, NO, that is NOT a rule here, so don't bother trying it.)

Rule Arguments

A rule can be assigned an argument, ?post=1, and is internally stored as $_GET['id'], which is read by getvar('id').

Rule Conditionals

Rule functions can be conditional. If a function returns a value it is stored. A following function can have an indicator to base it's execution on. The post rule is actually preceded by:


where validate() (a function in RULES.PHP) checks the value of getvar('id') for being numerical and existing in the database. If it returns FALSE, the function notfound() will be executed. The other conditionals are ? and :. The ? is for functions that return TRUE, and : is for an "else" construct:

        is_numeric $a
        ?display $a is a number
        :display $a is not a number

Since echo() and print() are not functions they cannot be used as rules; display() is a defined function that prints all of it's arguments and so does the equivalent.


The RULES.PHP file is only 250 lines long, and the rules algorithm is only 60 lines, and this is the best introduction to this code: small and efficient, simple and versatile. And we try real hard to make it so.

  1. A possible change may be to enclose arguments in quotes: display "this is a string" (but it is just a semantic thing).
  2. Though it probably ain't perfect.