Feature #30423

Rendering template of other action without forward

Added by Christopher Hlubek over 9 years ago. Updated about 8 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
MVC
Target version:
-
Start date:
2011-09-29
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

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.

#1

Updated by Christian Müller almost 9 years ago

  • Has patch set to No

What would be a use-case for this again?

#2

Updated by Christopher Hlubek almost 9 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