Making code more DRY
View Single Post
12-24-2009, 06:52 AM
Join Date: Feb 2007
There will be a little repitition, it's kinda hard to cut down on without getting extremely complex in your code. I have found however, that by switching to Kohana I have been able to cut back on a lot of extra work with views and a few other things by using their template_controller and all their factory chaining goodness :D
I have a similar app where I had to design an admin page. I didn't write a bunch of the same stuff over and over again, but I did need authentication a lot (which I used Simple_Auth for). I wrote a class to extend the template_controller (for the sake of understanding, since CI doesn't have template_controller, it basically allows you to avoid requiring/using new views for headers, footers, etc) and in the constructor I have a default access level.
I can pass either a required access level (such as administrator, moderator, editor or whatever) or an array of allowed groups. So I call the parent...
I know you've started with Code Ignitor and know CI (maybe even your client wants to use CI), but look into Kohana.
View Public Profile
Send a private message to Killswitch
Find More Posts by Killswitch