Change admin layout in CakePHP

后端 未结 4 1432
旧时难觅i
旧时难觅i 2021-02-15 09:17

I am working in cakephp, and I have the following two lines in my /app/config/routes.php file:

/**
 * ...and setup admin routing
 */
 Router::connect(\'/admin/:c         


        
4条回答
  •  旧时难觅i
    2021-02-15 09:58

    Add this code in beforeFilter() function in app_controller.php

    params['prefix']) && $this->params['prefix'] == 'admin') {
            $this->layout = 'admin';
        } else {
           $this->layout = 'user';  
        } 
    
        }
    
    }
    ?>
    

    Set layout='admin' in routes.php

     'users', 'action' => 'index','add', 'admin' => true,'prefix' => 'admin','layout' => 'admin'));
    ?>
    

提交回复
热议问题