Bug #67033
closed
Fluid StandaloneView does not resolve paths like EXT:my_ext/foo/bar
Added by Michael Grundkötter over 9 years ago.
Updated about 7 years ago.
Description
The class \TYPO3\CMS\Fluid\View\StandaloneView does not resolve file paths the same way like TemplateView does. Especially the method resolveFileNamePath is different. This leads to an error when partials or layouts are used and the layoutRootPaths TS setting is used. The paths there may be specified with EXT:<extension-name> which will not be resolved in this case.
To fix this, the methods getPartialPathAndFilename and getLayoutPathAndFilename should call GeneralUtility::getFileAbsFileName() on the filenames and the documentation should also contain the feature to use partials and layouts as well (http://wiki.typo3.org/How_to_use_the_Fluid_Standalone_view_to_render_template_based_emails).
- Target version set to 7.4 (Backend)
- Sprint Focus set to On Location Sprint
Can someone explain what does not work here? I tested these two configurations and they work fine:
Scenario 1¶
page.40 = FLUIDTEMPLATE
page.40 {
templateName = Test
layoutRootPaths {
10 = EXT:myext/Resources/Private/Layouts
}
partialRootPaths {
10 = EXT:myext/Resources/Private/Partials
}
templateRootPaths {
10 = EXT:myext/Resources/Private/Templates
}
}
Scenario 2¶
page.40 = FLUIDTEMPLATE
page.40 {
template = FILE
template.file = EXT:myext/Resources/Private/Templates/Test.html
layoutRootPath = EXT:myext/Resources/Private/Layouts
partialRootPath = EXT:myext/Resources/Private/Partials
}
- Status changed from New to Needs Feedback
Things are mixed up in the description. TypoScript has nothing to do with the StandAloneView. When using TypoScript, FLUIDTEMPLATE will resolve the paths and pass it to the StandAloneView.
Are you only using the StandAloneView and not FLUIDTEMPLATE, then resolve the path names in your own controller and pass them to the StandAloneView
This is working fine like Alexander describes.
Could you give more information where it goes wrong in your case?
Oh, wow. Did anyone of you actually read until the end? I posted nothing about any FLUIDTEMPLATE, did I? Whereas the link which I did post, leads to a page where example PHP code is shown, which is exactly what I do in my code. In PHP (not TS) I try to use this StandaloneView to render an email template. As there are base templates in a certain base folder A which may have been "overwritten" by an extension and a folder B. (because I dont actually want to "overwrite" the path, but instead provide an additional one while leaving the base path there, so not each template, partial and layout file needs to be copied into path B)
This (of course) has been configured in the TS setup of the extension, hence the TS reference in my description. Now (again): this does not work. If you take a closer look on what I wrote, there are method names and even the possible fix for this issue is described. Just take a look into the two different implementations of resolving the path names in those view classes and the penny will drop...
@Patrick Broens: I consider it not only misleading but even just bad behaviour when one view does resolve the path names correctly wheres the other one does not. Of course it is possible to let every extension author use the exact same code to solve this in their own extensions but I guess putting it in one central place (extbase) is the better solution in such a case. Do you agree?
- Target version changed from 7.4 (Backend) to 7.5
Hi,
i created a small test extension and i don't get the point. You will see in the extension that if you set a template for the StandaloneView and you define the LayoutRootPath and the PartialRootPath everything works fine.
If you don`t do that the view expects that your partials and layouts as a subfolder of the absolute template path.
You can checkout the extension on github.
https://github.com/markusguenther/mg_standaloneview
If i am wrong and just dont understand you please tell me that ;)
- Status changed from Needs Feedback to Resolved
the issue is solved in master, all template paths properties received stdWrap functionality and resolve the ext:Path Syntax correctly.
@Markus Günther: Yes, I see what you did and that's what I already wrote in the comment to Patrick (I consider it not only misleading but even just bad behaviour when one view does resolve the path names correctly wheres the other one does not. Of course it is possible to let every extension author use the exact same code to solve this in their own extensions but I guess putting it in one central place (extbase) is the better solution in such a case. Do you agree?) The behavior was not really "wrong" but inconsistent and unhandy, that's what I wanted to mention here.
@Anja Leichsenring: THANK YOU!!! :-)
- Sprint Focus deleted (
On Location Sprint)
- Status changed from Resolved to Closed
Also available in: Atom
PDF