Feature #7113

Make view resolution in ActionController independent from Fluid

Added by Christopher Hlubek over 11 years ago. Updated almost 11 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
MVC
Start date:
2010-04-02
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

Currently the view for any ActionController is tied to Fluid. For every action processed, a Fluid TemplateView will be created. Only if a template cannot be found the format is taken into account for the view object name.

This will work out as long as there is no Fluid template for an action that should be rendered with another view. Considering the case that we need format specific views (JSON, PDF, CSV, ...) for the same action that also renders HTML we need to change the current mechanism.

I would propose a priority based resolver like used for the request handlers. So a view would then be resolved by a view resolver that checks if a view implementation can handle the current request (most commonly by checking the format).

#1

Updated by Sebastian Kurfuerst over 11 years ago

I'll be available for such discussions

#2

Updated by Robert Lemke about 11 years ago

  • Assignee set to Christopher Hlubek
  • Target version set to 1.0 alpha 11

Okay, I think a decision based on the format would be okay. How about defining that directly in the Controller in form of an array?

$formatToViewObjectNameMap = array(
   '*' =>'F3\Fluid\View\TemplateView',
   'json' => '....MyOwnView',
   ..
);

could support regex.

Even if you don't like my suggestion, just start working on it ... you'll know how.

#3

Updated by Robert Lemke about 11 years ago

  • Status changed from New to Accepted
  • Assignee changed from Christopher Hlubek to Robert Lemke
#4

Updated by Robert Lemke about 11 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r5023.

#5

Updated by Julian Kleinhans about 11 years ago

I think there is something wrong..
since yesterday, after update the latest trunk i get a 404 with this error message from the action controller. "Sorry, the page you requested was not found. The technical reason is: No template was found. View could not be resolved for action "index".

Is there any change in the conventions ?
I have a StandardController with a indexAction method and i have a template in Resources/Private/Templates/Standard/index.html

any ideas ?

#6

Updated by Franz Kugelmann almost 11 years ago

Hi Julian,

did you try with the Template-name in UpperCase (Index.html)?
At least on non-Windows that makes a big difference :)
If i remember correctly, that was necessary at some point some months ago.

Julian Kleinhans wrote:

I think there is something wrong..
since yesterday, after update the latest trunk i get a 404 with this error message from the action controller. "Sorry, the page you requested was not found. The technical reason is: No template was found. View could not be resolved for action "index".

Is there any change in the conventions ?
I have a StandardController with a indexAction method and i have a template in Resources/Private/Templates/Standard/index.html

any ideas ?

Also available in: Atom PDF