Codeigniter share data from pre controller hook - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Codeigniter share data from pre controller hook (/showthread.php?tid=67957) |
Codeigniter share data from pre controller hook - vahid.vdn - 05-01-2017 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? RE: Codeigniter share data from pre controller hook - Martin7483 - 05-01-2017 If you want to reuse Controller code in multiple Controllers, then create a MY_Controller in ./application/core RE: Codeigniter share data from pre controller hook - vahid.vdn - 05-01-2017 (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. |