Welcome Guest, Not a member yet? Register   Sign In
One Controller
#12

[eluser]John_Betong[/eluser]
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
 
 
 
 


Messages In This Thread
One Controller - by El Forum - 04-19-2010, 12:54 AM
One Controller - by El Forum - 04-19-2010, 02:44 AM
One Controller - by El Forum - 04-19-2010, 03:11 AM
One Controller - by El Forum - 04-19-2010, 03:29 AM
One Controller - by El Forum - 04-19-2010, 03:46 AM
One Controller - by El Forum - 04-19-2010, 03:54 AM
One Controller - by El Forum - 04-19-2010, 04:02 AM
One Controller - by El Forum - 04-19-2010, 04:11 AM
One Controller - by El Forum - 04-19-2010, 08:39 AM
One Controller - by El Forum - 04-19-2010, 08:40 AM
One Controller - by El Forum - 04-19-2010, 10:06 PM
One Controller - by El Forum - 04-19-2010, 11:04 PM
One Controller - by El Forum - 04-19-2010, 11:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB