Bug #58746
closedsetTemplatePathAndFilename not work when original Template was not found
0%
Description
If I set a new Template in a controller action ( via $this->view->setTemplatePathAndFilename('path/to/template/List.html') ) I get this error when the original action file does not exist in the first place.
error:
Sorry, the requested view was not found.
The technical reason is: No template was found. View could not be resolved for action "search" in class "NWS\UserFjx217\Controller\FileController".
If the template search.html does not exist, I cannot use another template. This is somehow counterintuitive.
Updated by Markus Klein over 10 years ago
- Project changed from 534 to TYPO3 Core
Updated by Markus Klein over 10 years ago
- Category set to Extbase
- Is Regression set to No
- TYPO3 Version set to 6.2
Updated by Gerrit Code Review over 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30980
Updated by Markus Klein over 10 years ago
Can anyone provide an extension for testing the issue?
Thanks
Updated by Anja Leichsenring over 10 years ago
In extbase context, setTemplatePathAndFilename is no public API. You are to configure this via TypoScript, but not in the controller.
The only use case, where you set the template on your own, is for Fluid Standalone View.
If you really really REALLY need to change the Template in the code (and most probably, you do not need to), do it in the initialize*Action, but I can not think of any case where this would be neccessary. So proof my wrong and I will rethink my vote, or provide your use case to let us help you to figure out what needs to be done. Setting the template explicit in the controller action is not the way in any case.
Updated by Christian Kuhn over 10 years ago
- Status changed from Under Review to Rejected
Please use initialize*Action() to set stuff like template pathes.
Updated by Sybille Peters over 4 years ago
- Related to Bug #34844: view->setTemplatePathAndFilename bug added