HTML and CSS Reference
In-Depth Information
here's what the previous example would look like using getters and setters:
class RWA_Example
protected $magic = array();
public function __set( $key, $val )
$this->magic[$key] = $val;
public function __get( $key )
return $this->magic[$key];
$test = new RWA_Example;
// Sets custom properties
$test->foo = 'bar';
$test->bat = 'baz';
// Gets custom properties
echo $test->foo;
echo $test->bat;
this significantly improves the readability of the code and lowers the risk of typos, thus creating an effective
shortcut for adding properties to an object on the fly.
Creating the Abstract Model Class
The last core class needed is the Model class, which is the simplest of the three. For this app, all the Model class needs
to do is create a database connection.
In the system/core/ subdirectory, create a new file called and insert the following code:
* Creates a set of generic database interaction methods
* @author Jason Lengstorf <>
* @author Phil Leggetter <>
Search WWH ::

Custom Search