CI extend library


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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. */

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.