Call controller method within library without redirect |
Hey!
I'm building a library for CI and I need to run the callback after my logic. How do i call a controller method within library? I tried different ways and nothing worked ![]() PHP Code: $default_controller_callback = 'Welcome'; Here is the full library code: https://github.com/russ-ab/CodeIgniter-C...n.php#L192 I want to change the redirect to real callback calling. Thanks!
I have not looked at your full code (sorry) but I believe you cannot do what you ask (ie call controller method from somewhere else) without HMVC or similar. (I am not 100% on this though)
However there is no reason why your callback in, say, controller A, cannot call a common function (say 'common_callback_function') from a model or a library to get a result, just like any library or model call works. It is just a function after all. Then you are free to reuse that common_callback_function in any other library, or from where ever you want. Keeping everything DRY. I hope that makes sense. Paul. |
Welcome Guest, Not a member yet? Register Sign In |