TYPO3:TypoScript 中的后端布局条件 [英] TYPO3: Backend Layout Condition in TypoScript

查看:17
本文介绍了TYPO3:TypoScript 中的后端布局条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据页面的后端布局更改元素的呈现方式.
根据后端布局更改流畅样式的内容模板如下:

I'd like to change the way elements are rendered depending on the page's backend layout.
Changing the fluid styled content template depending on the backend layout works as following:

[globalVar = TSFE:page|backend_layout = 1][globalVar = TSFE:page|backend_layout = 2]
lib.fluidContent.templateRootPaths.10 = EXT:ds_res/Resources/Private/Templates/ContentTemplates/
[global]

如果是 1 或 2,则使用其他模板.

If it's 1 or 2, then use the other templates.

但是,这仅在 BE 布局直接设置在页面上时才有效,而当它从其父级继承时.
如何解决这个问题?

However, this only works if the BE layout is set directly at the page and not when it's inherited from its parent.
How to fix this?

运行 TYPO3 7.6.15
谢谢.

Running TYPO3 7.6.15
Thanks.

推荐答案

在 TYPO3 7.5 后端布局"中 - 条件已通过 Typoscript 中的页面布局"进行了简化.示例:

In TYPO3 7.5 "Backend Layout"-Conditions has been simplified with "pagelayout" in Typoscript. Example:

page.10 = FLUIDTEMPLATE
page.10 {
  file.stdWrap.cObject = CASE
  file.stdWrap.cObject {
    key.data = pagelayout
    default = TEXT
    default.value = EXT:sitepackage/Resources/Private/Templates/Home.html
    3 = TEXT
    3.value = EXT:sitepackage/Resources/Private/Templates/1-col.html
    4 = TEXT
    4.value = EXT:sitepackage/Resources/Private/Templates/2-col.html
  }
}

代替:

field = backend_layout
ifEmpty.data = levelfield:-2,backend_layout_next_level,slide
ifEmpty.ifEmpty = default

也许这也适用于您的条件:

Maybe this also works in your conditions like this:

[globalVar = TSFE:page|pagelayout = 1]

但是,您应该不要使用 [xy]-conditions 更改使用的模板文件,而是更喜欢使用上面示例中显示的 CASE.顺便说一下,每个数字都是一个backend_layout的UID.

However, you should not change the used template file with [xy]-conditions and prefer using a CASE shown in the example above. Each number is the UID of a backend_layout by the way.

这篇关于TYPO3:TypoScript 中的后端布局条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆