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/:controller/:action/*', array('action' => null, 'prefix' => 'admin', 'admin' => true, 'layout' => 'admin' ));
/**
* ...and set the admin default page
*/
Router::connect('/admin', array('controller' => 'profiles', 'action' => 'index', 'admin' => true, 'layout' => 'admin'));
I also have a layout at /app/views/layouts/admin.ctp
However, the layout is not changed when I visit admin URLs
Create a
app/app_controller.phpand put this in:Don’t forget to call
parent::beforeFilter();in your controllers if you use it in other controllers.Semi related to the question, you don’t need the routes defined, you just need to enable
Routing.adminconfig option and set it toadminin theapp/config/core.php. (CakePHP 1.2)