Welcome Guest, Not a member yet? Register   Sign In
Beginner's Question: Can I instantiate a controller from within a controller to access member functions?
#2

[eluser]richzilla[/eluser]
Short answer - no.

The simplest way around your problem as far as i can see, is to use a MY_Controller. This way you can store functions that may be used in many controllers all in one place. to do this create a MY_Controller.php file in the libraries folder of your application.

Code:
<?php

    class MY_Controller extends Controller{
        
        function MY_Controller()
        {
            parent::Controller();    
        }
        
        
        
    }

Then have all of your controllers inherit this class:

Code:
<?php

    class Controller_name extends MY_Controller{

        function __construct()
        {
             parent::MY_Controller();
        }

    }

This way any functions in your MY_controller will also be inherited by the controller.


Hope this helps.


Messages In This Thread
Beginner's Question: Can I instantiate a controller from within a controller to access member functions? - by El Forum - 01-12-2010, 07:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB