Welcome Guest, Not a member yet? Register   Sign In
Common methods for all controllers
#1

[eluser]owidiuszek[/eluser]
Hello,

What is the best way to make few methods available to all controllers?

for example some result view:

Code:
function showResult($text, $state)
    {    
        $data['page'] = "result_view";
        $data['text'] = $text;
        $data['state'] = $state;
        $this->load->view('main', $data);
    }
And I would liek to access it from every controller in my app like:
$this->showResult('aaa','bbb'); (or similar)

without pasting this code inside each controller.

Should I create for example maincontroller and then extend all others basing on it?
Or maybe usage of library or helper would be better?


Messages In This Thread
Common methods for all controllers - by El Forum - 12-14-2009, 05:26 AM
Common methods for all controllers - by El Forum - 12-14-2009, 06:52 AM
Common methods for all controllers - by El Forum - 12-14-2009, 06:59 AM
Common methods for all controllers - by El Forum - 12-14-2009, 07:02 AM
Common methods for all controllers - by El Forum - 12-14-2009, 09:10 AM
Common methods for all controllers - by El Forum - 12-14-2009, 10:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB