[eluser]$ilovephp[/eluser]
[quote author="John_Betong" date="1271757883"]I take it that you did not search for extending MY_Controller so here is how to have individual controllers that use extend the
./application/libraries/MY_Controller.php
Code:
class MY_Controller extends Controller
{
function __construct()
{
parent::Controller();
$this->load->helper('html');
}
function fred($title='Jack')
{
echo heading($title);
}
}//endclass
./application/controllers/ci_first.php
Code:
class ci_first extends MY_Controller
{
function __construct()
{
parent::Controller();
}
function index
{
$this->fred();
$this->fred('jack');
$this->fred('harry');
}
}//endclass
./application/controllers/ci_second.php
Code:
class ci_second extends MY_Controller
{
function __construct()
{
parent::Controller();
}
function index
{
$this->fred();
$this->fred('jack');
$this->fred('harry');
}
}//endclass
[/quote]
Thank you very much! I find it very useful.