Writing Admin/User/Public controllers to insure authentication |
(12-23-2014, 10:27 AM)sneakyimp Wrote:(12-23-2014, 04:40 AM)Avenirer Wrote: Well... If you are talking about best practices, the best practice would be to have only a MY_Controller. If you are talking about your needs and how you see it easier to implement them your application, CodeIgniter is basic enough to allow you to do whatever you want and make it as complex as you want, if you know how.Avenirer, I'm guessing that's your article? It's nice. I'm inclined to trust you but just want to be sure. Perhaps you could more specifically address this question that I asked: In my opinion, putting an autoload inside... wherever (some people put it into config, some people put it into main index.php)... is a bit hack'ish... That is because, after you've done that you may have forgotten where you've put it. Hobbes' suggestion is no better than the first method, that is because is not a good practice, you simply put the autoload inside a MY_Controller. On the other hand we have the hooking system which, logically seems better than the first options. That is because we establish an order of loading the classes, and also we know from the start where to look for the autoloader. Another method, which I think would be the best but I didn't have the time to look into (that is "I don't know yet how to implement"...) would be to use the Composer and then use namespacing when defining and asking for the necessary controller. Website: http://avenir.ro
|
Welcome Guest, Not a member yet? Register Sign In |