[TYPO3-english] Fluid templates and variables

bernd wilke t3ng at bernd-wilke.net
Wed Dec 11 11:39:39 CET 2013


Am 11.12.13 10:33, schrieb Ollie New:
> Hi all,
>
> I'm working on my first Typo3 site and from what I have read Fluid
> templates seem to be the way to go.
>
> However, I can't seem to output constants or variables in my Fluid
> template. I am using Typo3 version 4.5.3 (at the request of our client!)
> so I understand that I need to use the variables array rather than
> settings in my page setup. For example:
>
> page.10 = FLUIDTEMPLATE
> page.10 {
>     variables {
>         copyrightYear = 2013
>     }
> }
>
> So if I want to output the copyrightYear in my Fluid template, I should
> just use {copyrightYear} right? or should I use
> {variables.copyrightYear}? I have tried both and nothing is rendered to
> the page.

you need TYPO3 Objects
simple Text can be a TEXT-object:
page.10 {
	variables {
		copyrightYear = TEXT
		copyrightYear.value = 2013
	}
}


> Also, let's say I have a TS constant set, for example:
>
> myVar = 123ABC
>
> How would I access that in the Fluid template? I have tried a few
> obvious things with no luck.

Typoscritp-constants are only known while rendering the typoscript.
so you need to use the constant in your typoscript-setup like:

page.10 {
	variables {
		myVar = TEXT
		myVar.value = {$myVar)
	}
}

distinguish these different usages of myVar:
on the left of the equal signs it is a typoscript-setup object, which is 
transfered as variable to fluid, where you can use it in the 
fluid-notation '{myVar}'
right of the equal sign is the TS-constant which is used in the 
TS-notation for constants with a leading '$' inside the braces.


bernd
-- 
http://www.pi-phi.de/cheatsheet.html


More information about the TYPO3-english mailing list