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

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -