I created a newsletter submission layout, called email.ctp , and put it inside the View / Layout directory. My question is how do I use this layout instead of the default.ctp
I created a newsletter submission layout, called email.ctp , and put it inside the View / Layout directory. My question is how do I use this layout instead of the default.ctp
You will need to use $this->layout = ...;
on your AppController
You can use:
public function beforeRender() {
parent::beforeRender();
$this->layout = 'layout_customizado';
}
Another example would be to apply a layout for each "View" within AppController
class UsersController extends AppController {
public function view_active() {
$this->set('titulo_para_o_layout', 'Ver atividade dos usuários');
$this->layout = 'layout1';
}
public function view_image() {
$this->layout = 'layout_image';
//Mostra foto do usuário
}
}