Welcome Guest, Not a member yet? Register   Sign In
Extended Controllers vs. Hooks

I am putting together my CMS written in Codeigniter and was told for things like checking if a user is logged in and what not things like that could go in a parent controller for an Admin_Controller but I'm also being told from a good coding friend of mine that he thinks its better to use hooks for this.

I wanted to get some opinions on what is really more practical and should be used?

Probably just personal preference. I use an admin_controller myself as I only need auth for the backend and hooks are called for everything. Either way will probably work depending on the hook and whats loaded at that point and I don't think you can say one is better than the other. Both would have to load the same number of extra files. It would be interesting to benchmark.

I've only used one pre-system hook and that was for debugging so it could load before most of CI loads so I could get complete stack traces using Dan Horrigans port of UhOh for CI. Other than that, never needed them but glad they are available.


Thank you.

Theme © iAndrew 2016 - Forum software by © MyBB