简体   繁体   English

打字稿对象变量和在Fluid模板中的访问

[英]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 . 我有一个项目,它在文件夹fileadmin / templates中包含所有模板,css,布局和图像。

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. 在我的布局中,我有多个指向fileadmin / images文件夹中存在的图像的链接,将所有链接都引用到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 并从HTML页面访问它

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

I am using Typo3 version 6.0.4. 我正在使用Typo3 6.0.4版本。

You may use pathImages , pathCss and pathJs . 您可以使用pathImagespathCsspathJs

TypoScript does not know about arrays and there is no way to return an array via TypoScript . TypoScript不了解数组,因此无法通过TypoScript返回数组。 TypoScript is transformed into a PHP array by separation it at the dots and then it is rendered via multiple foreach loops. TypoScript通过在点处分隔将其转换为PHP数组,然后通过多个foreach循环进行呈现。 Only strings are returned as a result of this process. 由于此过程,仅返回字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM