Just a quick post but it is one that I had to use recently so thought I would quickly make a note of it so that it helps others out.
With the new year coming I had to update a sites copyright year which was displayed in the footer. It was a simple enough thing to do but I feared that I would need to be doing it again this time next year.
The solution was to use PHP to output the current year.
echo date("Y");
If your server doesn’t support PHP check see if there are any other server side scripting languages such as ASP, Perl, Python or Ruby etc They all have similar functions for returning the current year.

PHP
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

Development, PHP
Hi this is my first post in the way of development on my blog.
I have decided to upload my database class that I use for projects. Its by no means perfect. There is quite a heated debate on Singleton classes themselves. However I like how it works for me. I can query query a database quicklyby simply using:
<?php
$db = Database::getInstance();
$results = $db->query("SELECT * FROM test WHERE name = :name",array(":name" => "matthew"));
print_r($results);
?>
Read more…

PHP
Database Class, PHP, Singleton Database Class