Your leaking thatched hut during the restoration of a pre-Enlightenment state.


Hello, my name is Judas Gutenberg and this is my blaag (pronounced as you would the vomit noise "hyroop-bleuach").


decay & ruin
Biosphere II
dead malls
Irving housing

got that wrong

appropriate tech
Arduino μcontrollers
Backwoods Home
Fractal antenna

fun social media stuff

(nobody does!)

Like my brownhouse:
   keeping it code neutral
Friday, July 27 2007

The main library of my accumulated wisdom concerning PHP interactions with a MySQL database is a 4200 line file called admin_functions.php. It's a long list of functions with names such as foreigntablepulldown, FleshedOutFKSelect, firstnonidcolumname, RelationLookup, GenericTablePulldown, and makeXMLNode. This file has been something of a code snowball rolling down the snowy slope of my career, gathering more and more functions the further it goes. Onto the next simile: it's also like a species' genome in that it's both a dumping ground and gradually-improving set of information. While admin_functions.php contains functions that I haven't used in any recent projects, some of its core functions have been used in every one and have been gradually tweaked and have had their scope expanded. In some cases, I've transformed specific functions into more general cases and redone the old specific-case function as a hollowed-out husk that merely sets parameters to hard-coded values and then calls the generic version.
Thus, though admin_functions.php acts as the main chromosome of information for all my PHP/MySQL projects, I have not treated it like a perfect holy text. I'm constantly fiddling with it and incorporating new code to implement valuable new features or to address the needs of clients. And, unlike with biological chromosomes, I've struggled to keep it backwards-compatible, such that I can overwrite the old admin_functions.php from two projects ago with the latest version, seamlessly adding features and fixing bugs without breaking any functionality.
So you can imagine my horror today when my colleague on an ongoing project announced that he'd taken a knife to admin_functions.php just to add a company-specific graphical header to the generic database administrative login form (in a function called loginarrest). It ended up being a simple matter to incorporate that same functionality via a small edit to the generic ("code-neutral") admin_functions.php include and the addition of specific design information to a style sheet (which I can happily alter for every project). The result is that now all future projects using this function library can easily have their login forms decorated with any arbitary logo. I can also easily add logos to the login forms of all our past projects, all while keeping the underlying code completely generic.

For linking purposes this article's URL is:

previous | next