Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render TYPO3 Fluid partial from another extension

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.

like image 880
kimomat Avatar asked Dec 15 '16 14:12

kimomat


1 Answers

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.

like image 59
Daniel Avatar answered Sep 27 '22 15:09

Daniel