Feature #30423

Rendering template of other action without forward

Added by Christopher Hlubek almost 4 years ago. Updated over 2 years ago.

Status:New Start date:2011-09-29
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:MVC
Target version:-
PHP Version: Complexity:
Has patch:No

Description

Rendering a template of another action without doing a forward is currently too complicated. It should be possible by just calling

$this->view->render('actionName');

The problem is a call to resolveView which automatically uses a NotFoundView for the view.

History

#1 Updated by Christian Müller over 3 years ago

  • Has patch set to No

What would be a use-case for this again?

#2 Updated by Christopher Hlubek over 3 years ago

Well, everytime you want to render a template that is not named by the action or you don't want to forward to another action to render its template. Of course in simple CRUD cases this is not needed. Some things I can think of are:

  • Multiple templates depending on some value inside the action (I would consider switching to other partials inside one template a workaround)
  • You cannot forward to another action (e.g. arguments not serializable) but want to render its template

Also available in: Atom PDF