Im uploading this scaffolding class so that hopefully some other people can find use for it. It is based on the excellent tutorial on building a scaffolding class by Ben Hirsch which can be found here http://www.shadow-fox.net/site/tutorial/39-Creating-A-Scaffold-like-Class-in-PHP-or-An-Automatic-CMS-For-a-Table Sadly i can’t seem to find the original post however I’m sure its nothing a quick google can’t fix.

There is a link to the download at the end of this post.

I have used it to get projects going quickly. It can be pointed to a mysql database and can read the tables in etc and generate the CReate Update and Delete (CRUD) similar to how ruby on rails has scaffolding.

It is by no means perfect and could do with some refinements here and there. It is however quite functional in its current state and has support for foreign keys and image uploads.

There are some naming conventions to be adhered to if you want to get the most out of this. However you can quickly go through it and change these to whatever you like.

Here is a list of column names and how the Scaffolding Class reacts to them:

Column Name Data Type Scaffolding Output
image_url varchar(255) Image Upload Field
varchar Text Input
text Textarea
“foreigntable_id” INT Outputs the “name” field from the lookup table “foreigntable”
datetime A date/time drop down selector.
Last three characters ‘_on’ INT A Yes/No drop down selector.

I have used this for many projects to get them off the ground. For simple admin areas it works perfectly.

Would love to hear your thoughts and comments.

Download Scaffolding.zip