| Beide Seiten, vorherige ÜberarbeitungVorherige ÜberarbeitungNächste Überarbeitung | Vorherige Überarbeitung |
| typo3:templating:fluidtemplate [2019/11/07 18:52] – [Assets über Fluid] admin | typo3:templating:fluidtemplate [2021/03/02 19:54] (aktuell) – Condition für alternatives Fluid-Layout admin |
|---|
| |
| Quelle: [[https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/8.6/Feature-79413-AutorenderAssetSectionsInFluidTemplateContentObject.html|TYPO3 Changelog #79413]] | Quelle: [[https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/8.6/Feature-79413-AutorenderAssetSectionsInFluidTemplateContentObject.html|TYPO3 Changelog #79413]] |
| | |
| | ---- |
| | |
| | ===== Einem Fluid Partial zusätzliche Argumente übergeben ===== |
| | |
| | <code html> |
| | <f:alias map="{footerClassList: 'c-site-footer c-site-footer--dark'}"> |
| | <f:render partial="Site/Footer" arguments="{_all}"/> |
| | </f:alias> |
| | </code> |
| | |
| | Quelle: [[https://stackoverflow.com/a/44584209/5157290|Claus Fassing auf StackOverflow]] |
| | |
| | ---- |
| | |
| | ===== Inhaltsspalte (colPos) in Fluid auf Inhalt prüfen ===== |
| | |
| | Das folgende Snippet rendert einen Teil des Fluid-Templates nur, wenn die angegebene Inhaltsspalte auch Inhalt besitzt (der nicht deaktiviert ist). Praktisch z.B. für ''<aside>'' Bereiche, die nicht auf jeder Unterseite enthalten sind. |
| | |
| | **Voraussetzung:** das TypoScript-Objekt [[https://docs.typo3.org/c/typo3/cms-fluid-styled-content/master/en-us/Installation/InsertingContentPageTemplate/Index.html|lib.dynamicContent]] muss vorhanden sein! Dies ist kein Teil des TYPO3-Kerns und muss selbst ergänzt werden. |
| | |
| | Die Vorgehensweise mit ''cObject'' und Variablenzuweisung hat zudem den Vorteil, dass nur eine Datenbankabfrage erfolgen muss. |
| | |
| | <code html> |
| | {f:cObject(typoscriptObjectPath: 'lib.dynamicContent', data: {colPos: 0}) -> f:variable(name: 'content')} |
| | <f:if condition="{content}"> |
| | <aside class="optional-stuff"> |
| | // Render stuff |
| | </aside> |
| | </f:if> |
| | </code> |
| | |
| | Quelle: [[https://stackoverflow.com/a/53652375/|Claus Due auf StackOverflow]] |
| | |
| | ---- |
| | |
| | ===== Condition für alternatives Fluid-Layout ===== |
| | |
| | Eine ''f:if''-Condition kann problemlos innerhalb des ''name''-Arguments verwendet werden. Eine Condition um den ''f:layout''-Viewhelper herum würde aber nicht funktionieren. |
| | |
| | <code html> |
| | <f:layout name="{f:if(condition: '{data.someData} == 123', then: 'SpecialLayout', else: 'Default')}" /> |
| | </code> |
| | |
| | Quelle: [[https://stackoverflow.com/a/53300737/|Rudy Gnodde auf StackOverflow]] |
| | |