dora
dora

Reputation: 1344

Typoscript object variables and accessing in Fluid templates

I have a project which has it's all templates, css, layouts and images in the folder fileadmin/templates .

In my layouts I have multiple links to the images present in the fileadmin/images folder and it looks kinda complex to have all the links to be referred to fileadmin/images.

Example : 
src="fileadmin/images/dog.jpg"
src="fileadmin/images/cat.jpg"
src="fileadmin/images/monkey.jpg"

Instead of doing this can I assign a object in the typoscript (..in the template) like

page.10 = FLUIDTEMPLATE
page.10{
variables{
    paths.images=fileadmin/images
    paths.css=fileadmin/css
    paths.js=fileadmin/js
}
}

and access this from the HTML pages as

src="{paths.images}/cat.jgp"
src="{paths.js}/close.js"

I am using Typo3 version 6.0.4.

Upvotes: 0

Views: 2108

Answers (1)

pgampe
pgampe

Reputation: 4578

You may use pathImages, pathCss and pathJs.

TypoScript does not know about arrays and there is no way to return an array via TypoScript. TypoScript is transformed into a PHP array by separation it at the dots and then it is rendered via multiple foreach loops. Only strings are returned as a result of this process.

Upvotes: 1

Related Questions