Development Process
As always, we will start by defining our global constants, then we’ll move onto create our
data schema (and database), followed by our data class, then our box classes and finally, we’ll create
the .phtml file, which will bring it all together into a working example – or at least, that’s the plan
at the moment!
data schema (and database), followed by our data class, then our box classes and finally, we’ll create
the .phtml file, which will bring it all together into a working example – or at least, that’s the plan
at the moment!
Constants
This is a straight forward PHP file, which I create to define Constant values I can use
across a whole site. By using this – appropriately – I can change the look/feel of a site from one
place, rather than having to chase variable values across multiple pages. Here’s our constants.inc sample:
across a whole site. By using this – appropriately – I can change the look/feel of a site from one
place, rather than having to chase variable values across multiple pages. Here’s our constants.inc sample:
<?php
// Database Constants
$HOST = "localhost";
$DB = "testing";
$WEBUSER = "root";
$WEBPASSWORD = "";
// Colour Constants
$COLOR_PRIMARY = "#037B0B";
$COLOR_SECONDARY = "#FFFFC0";
$COLOR_TERTIARY = "#ECED81";
// Value Constants
$TRUE = 1;
$FALSE = 0;
// Application Specific
$TITLE = "Object Orientation Demonstration";
$ADMINEMAIL = "[email protected]";
// CSS Plug-in Values
$CSSBOXTITLE = "boxtitle";
?>
Database Schema
Under no circumstances should this be taken as a de-facto database schema, but it works for
the purposes of this example:
the purposes of this example:
As you can see, the data for News is in a table in its own right, whilst the race, driver,
team and points details are the result of related tables. Suffice to say, if you do not understand
this schema, you should go and read up on some RDBMS introductory material before going any further.
team and points details are the result of related tables. Suffice to say, if you do not understand
this schema, you should go and read up on some RDBMS introductory material before going any further.