Welcome Guest, Not a member yet? Register   Sign In
Codeigniter share data from pre controller hook
#1

I want to do the similar job in controllers constructors. So I don't want to repeat it in each controller. Instead, I want to write it once in hook.

It works fine in post_controller_constructor hook with ci super object. But cannot access it in the controller's constructor (Only functions of a controller).

pre_controller doesn't work. Because we don't access to ci super object at all. Any idea?
Reply
#2

If you want to reuse Controller code in multiple Controllers, then create a MY_Controller in ./application/core
Reply
#3

(05-01-2017, 04:27 AM)Martin7483 Wrote: If you want to reuse Controller code in multiple Controllers, then create a MY_Controller in ./application/core

Thanks. Done.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB