I want to make the "Sign In/Up" page different from others, So, In my UsersController
, most of the action like indexAction
, profileAction
will use the 3 view files:
- view/index.volt
- view/layouts/main.volt
- view/users/index.volt or profile.volt
and the registerAction
and loginAction
will use ONLY 2 view files:
- view/index.volt
- view/users/register.volt or login.volt
That's I DON'T want this two actions to use the Controller Layout view/layouts/main.volt
thus, my code is like this:
class UsersController extends ControllerBase
{
public function initialize()
{
parent::initialize();
$this->view->setTemplateBefore("main");
}
public function indexAction()
{
}
public function registerAction()
{
$this->view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT);
$form = new RegisterForm();
...
$this->view->form = $form;
}
public function loginAction()
{
$this->view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT);
$form = new LoginForm();
...
$this->view->form = $form;
}
}
according to the code above, indexAction
display properly(3 view files work well)
but the registerAction
and loginAction
still have the 3 view files! the view/layouts/main.volt
still works!
How to correct it?