Render TYPO3 Fluid partial from another extension
Asked Answered
C

1

8

I want to render a section in a partial from another extension. My setup is TYPO3 7.6.14 with fluid powered TYPO3 extensions including VHS.

As far as i know it is not possible with the fluid ViewHelper f:render. Here you only have the arguments "partial" and "section". I found one solution using the VHS ViewHelper v:render.template. The solution is explained here: https://www.wapplersystems.de/blog/typo3-fluid-render-partial-from-another-extension/

But with this ViewHelper I can only set the path to the partial, but not to the section.

Cannabin answered 15/12, 2016 at 14:52 Comment(0)
S
20

Fluid supports a lookup chain for partials, templates and layouts. You can specify multiple directories in your extension and fluid will look in all of them (beginning at the highest index) until it finds a matching partial file.

plugin.tx_myextension.view {
   partialRootPaths {
      10 = EXT:my_extension/Resources/Private/Partials
      20 = EXT:another_extension/Resources/Private/Partials
   }
}

With this configuration fluid will look for every partial in your extension at another_extension/Resources/Private/Partials first and render it from there if it is present.

Semidiurnal answered 15/12, 2016 at 19:43 Comment(2)
Thanks for the answer. This is also my current solution. But it is not very satisfying, because you alway have to check against overriding partials from the current extension. Thats why i was hoping finding another solution, where i you only will Path to one single Partial and not include the whole partial folder.Cannabin
@Cannabin As the entries this list are looked up in ascending order, how bout you create a folder where only your generalized templates go into and place that on top of the list.Flatulent

© 2022 - 2024 — McMap. All rights reserved.