Fluid - Snippets: Unterschied zwischen den Versionen
Aus Wikizone
| Zeile 1: | Zeile 1: | ||
| − | |||
== Links == | == Links == | ||
| Zeile 9: | Zeile 8: | ||
== Lokalisierung - Mehrsprachigkeit == | == Lokalisierung - Mehrsprachigkeit == | ||
<f:translate key="tx_gbbandpass_domain_model_band.name" /> | <f:translate key="tx_gbbandpass_domain_model_band.name" /> | ||
| − | == Links == | + | == Links erzeugen == |
http://wiki.typo3.org/De:ViewHelper/Link | http://wiki.typo3.org/De:ViewHelper/Link | ||
=== Link auf Action Controller z.B. Einzelansicht (show) - f:link.action === | === Link auf Action Controller z.B. Einzelansicht (show) - f:link.action === | ||
| Zeile 24: | Zeile 23: | ||
=== Seitenlink - f:link.page === | === Seitenlink - f:link.page === | ||
<f:link.page pageUid="1" additionalParams="{foo: 'bar'}">page link</f:link.page> | <f:link.page pageUid="1" additionalParams="{foo: 'bar'}">page link</f:link.page> | ||
| + | |||
| + | === Bilder === | ||
| + | <f:image src="EXT:myext/Resources/Public/typo3_logo.png" alt="alt text" maxWidth="200"/> | ||
| + | |||
| + | === Bedingungen === | ||
| + | ==== Template Variable mit String vergleichen ==== | ||
| + | http://www.typo3lexikon.de/typo3-tutorials/extensions/fluid/fluid-tipps-und-tricks.html | ||
| + | |||
| + | Funktioniert im Moment (2014) noch nicht: | ||
| + | <pre> | ||
| + | <f:if condition="{data.ctype} == 'table'"> | ||
| + | {data.bodytext} | ||
| + | </f:if> | ||
| + | </pre> | ||
| + | |||
| + | So geht's: | ||
| + | |||
| + | Über einen Alias | ||
| + | <pre> | ||
| + | <f:alias map="{myText: 'table'}"> | ||
| + | <f:if condition="{data.ctype} == {myText}"> | ||
| + | {data.bodytext} | ||
| + | </f:if> | ||
| + | </f:alias> | ||
| + | </pre> | ||
| + | |||
| + | Über ein Array | ||
| + | <pre> | ||
| + | <f:if condition="{0:data.ctype} == {0:'table'}"> | ||
| + | {data.bodytext} | ||
| + | </f:if> | ||
| + | </pre> | ||
| + | Die Array-Lösung hat auch noch den Vorteil, dass man mehrere Werte gleichzeitig überprüfen kann: | ||
| + | <pre> | ||
| + | <f:if condition="{0:data.ctype,1:data.hidden,2:data.deleted} == {0:'table',1:'0',2:'0'}"> | ||
| + | {data.bodytext} | ||
| + | </f:if> | ||
| + | </pre> | ||
| + | |||
| + | == RTE Inhalte Rendern == | ||
| + | <f:format.html>{content.bodytext}</f:format.html> | ||
| + | Funktioniert aber nicht bei allen CTypes, weil die entsprechenden CSS_Styled_Content Funktionen nicht ausgeführt werden | ||
| + | <pre> | ||
| + | <f:if condition="{content.ctype}"> | ||
| + | <f:cObject typoscriptObjectPath="tt_content.{content.ctype}.20" data="{content}" /> | ||
| + | </f:if> | ||
| + | </pre> | ||
| + | Beachtet aber, dass Ihr für diese Lösung auch alle benötigten tt_content-Felder in Eurem Model definiert habt. | ||
Version vom 26. November 2014, 11:54 Uhr
Links
http://wiki.typo3.org/Category:De:fluid
Debugging
<f:debug title="band">{band}</f:debug>
Lokalisierung - Mehrsprachigkeit
<f:translate key="tx_gbbandpass_domain_model_band.name" />
Links erzeugen
http://wiki.typo3.org/De:ViewHelper/Link
Link auf Action Controller z.B. Einzelansicht (show) - f:link.action
<f:link.action action="show">action link</f:link.action>
<f:link.action action="show" arguments="{band : band}"> {band.name}</f:link.action>
E-Mail Link - f:link.email
<f:link.email email="foo@bar.tld" />
Externer Link - f:link.external
Standard Scheme ist http es gehen aber auch andere z.B. ftp:
<f:link.external uri="typo3.org" defaultScheme="ftp">external ftp link</f:link.external>
Seitenlink - f:link.page
<f:link.page pageUid="1" additionalParams="{foo: 'bar'}">page link</f:link.page>
Bilder
<f:image src="EXT:myext/Resources/Public/typo3_logo.png" alt="alt text" maxWidth="200"/>
Bedingungen
Template Variable mit String vergleichen
http://www.typo3lexikon.de/typo3-tutorials/extensions/fluid/fluid-tipps-und-tricks.html
Funktioniert im Moment (2014) noch nicht:
<f:if condition="{data.ctype} == 'table'">
{data.bodytext}
</f:if>
So geht's:
Über einen Alias
<f:alias map="{myText: 'table'}">
<f:if condition="{data.ctype} == {myText}">
{data.bodytext}
</f:if>
</f:alias>
Über ein Array
<f:if condition="{0:data.ctype} == {0:'table'}">
{data.bodytext}
</f:if>
Die Array-Lösung hat auch noch den Vorteil, dass man mehrere Werte gleichzeitig überprüfen kann:
<f:if condition="{0:data.ctype,1:data.hidden,2:data.deleted} == {0:'table',1:'0',2:'0'}">
{data.bodytext}
</f:if>
RTE Inhalte Rendern
<f:format.html>{content.bodytext}</f:format.html>
Funktioniert aber nicht bei allen CTypes, weil die entsprechenden CSS_Styled_Content Funktionen nicht ausgeführt werden
<f:if condition="{content.ctype}">
<f:cObject typoscriptObjectPath="tt_content.{content.ctype}.20" data="{content}" />
</f:if>
Beachtet aber, dass Ihr für diese Lösung auch alle benötigten tt_content-Felder in Eurem Model definiert habt.