Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to change the to-be-renderable .phtml file in controller?

say, Im in:

<?phppublic function indexAction()
{
}

no matter whay I am doing, the index.phtml will be generated. But due to a reason, sometimes "index2.phml" must be rendered. So, how to say what file to render?



62.7k
Accepted
answer
$this->view->pick(array('templates/edit'));

If you dont change any rules for generating views default action is :

If controller dont return anything and you didnt change any rules for generating views then -> its searching for directory with controller name -> its picking view called as action(so if you have showAction - show, indexAction - index etc) -> and its rendering this view.