Posted By

antoniomax on 11/21/08


Tagged

library create extend ci your own


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

localhorst
vali29


CI extend library


 / Published in: PHP
 

URL: http://codeigniter.com/forums/viewthread/82397/#414367

  1. /*
  2. Create a new library file called MY_Controller:
  3. class Administrator extends Controller
  4. */
  5. {
  6. function Administrator()
  7. {
  8. parent::Controller();
  9.  
  10. // Protect the admin area, etc
  11. $this->access->restrict('Administrators');
  12. }
  13.  
  14. }
  15. /*
  16. Then for your admin controllers you extend the Administrator class instead of the Controller. That way you have common administrative logic in one place.
  17. */

Report this snippet  

You need to login to post a comment.