actionshrimp.com

fun and geekery

CakePHP: PagesController with Admin Routing

For small Cake websites with admin routing enabled, I like to use the Auth component to require a login for all admin routes, and allow access to everything else using the following beforeFilter in the AppController superclass: function beforeFilter(){ $admin = Configure::read('Routing.admin'); if (isset($this->params[$admin]) and $this->params[$admin]){ $this->layout = 'admin'; } else { $this->Auth->allow(); } } [...]