Load a different layout in PagesController

I have the method beforeFilter where I load a layout but in the method “admin” I want to load a different layout and it doesn’t let me do it.


If I delete the beforeFilter method, I don’t load any layout. How can i fix this? Thank you

You will need to enable first path to “admin” or anything in …/Config/core.php
Configure::write(‘Routing.prefixes’, array(‘admin’, ‘agent’, ‘moderator’));

You need to load your default layout in initialize methode

public function initialize() {

then in any method you can override the default layout

   public function admin() {