[eluser]oddman[/eluser]
Trying to figure out how to extend the controller class to include functions I can use in the child controllers, like my Home controller. Keeps saying the methods supplied don't exist. I realise this is because Home controller extends Controller, should this be changed to MY_Controller? Code is below:
Code:
<?php
/*
* MY_Controller
* Extension of the core Controller class, in order to provide some unified methods for setting
* and retrieving data that can be used as part of the controller, it's children, or modularised hooks.
*
* @author Kirk Bushell
* @date 27/05/2008
* @company Nanoweb
* @URL http://www.nanoweb.com.au
*/
class MY_Controller extends Controller {
/*
* Array that will contain the variables we set
* @var array $_data
*/
var $_data;
/*
* set
* Use to set MY_Controller::_data variable
*
* @param mixed $var Could be a single value or an array
* @param string $name Default null. If $name is not specified, $_data is overwritten with the new value
*/
function set($var, $name = null)
{
if (!is_null($name)) {
$this->_data[$name] = $var;
}
else {
$this->_data = $var;
}
}
/*
* get
* Retrieve a value from the MY_Controller::_data variable
*/
function get($name = null)
{
return (!is_null($name)) ? $this->_data[$name] : $this->_data;
}
}
?>