CodeIgniter Forums
private controller function from model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: private controller function from model (/thread-18123.html)



private controller function from model - El Forum - 04-26-2009

[eluser]Fenix[/eluser]
I have an error function in my controller that sets the respective http status header, outputs the error, and exits. I'd like to be able to call this from my model.

I guess this is more just a general OO PHP syntax question, but, how can this be done?


private controller function from model - El Forum - 04-26-2009

[eluser]Dam1an[/eluser]
The more information (such as what code you have so far etc), the more people can help you Wink


private controller function from model - El Forum - 04-26-2009

[eluser]Fenix[/eluser]
The function (what exactly it does is irrelevant, I just want to know how to call it from a model which I load from the controller):
Code:
private function _errorOut($error_code)

The way I use it in my controller:
Code:
$this->_errorOut(1004);

I can't call it this way from my model because the function isn't located there.