php - codeigniter, uri routing and subcontrollers -
not sure how this... have controller name admin- , want use controllers in subfolder "sub" controllers
i.e when user visits mydomain.com/admin redirected if not logged , if visit mydomain.com/admin/customers redirected actual customers class stored in controllers/admin/customers.php
i want admin controller handle check if logged in , add on header template?
how can route this?
if understand correctly, try extending base controllers
<?php class my_controller extends controller { function __construct() { parent::__construct(); if(!$this->auth->logged_in()) { redirect('login'); } } } class customer extends my_controller { // if user isn't logged in redirected }
i cite once again phil sturgeon
Comments
Post a Comment