问题描述
我使用这个条件
[globalVar = GP:colPos==0]&&[page|backend_layout = pagets__MainTemplate]
我的问题是我的子页面"没有选择 backend_layout,因为父页面后端布局(此页面的子页面)"已设置.因此该条件不适用于子页面.
My problem is that my „subpage" has no backend_layout selected because the parent pages "Backend Layout (subpages of this page)" is set. So the condition does not work on subpages.
可以创造这样的条件吗?
Can create a condition like that?
lib.backendLayout = TEXT
lib.backendLayout {
data = levelfield:-1, backend_layout_next_level, slide
override.data = TSFE:page|backend_layout
}
我想以这种方式在 BE 列中做白/黑名单 CType:
I want do white/blacklist CTypes in BE Columns in this way:
[globalVar = GP:colPos==0]&&[page|backend_layout = pagets__MainTemplate]
TCEFORM.tt_content.CType.keepItems := addToList(header)
[end]
推荐答案
据我所知,您只能访问带有页面"条件的当前页面记录.
Not as far as I know, as you can only access the current page record with the "page" condition.
相反,你可以
a) 编写您自己的条件(参见 https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Conditions/Reference/Index.html#custom-conditions 或从版本 9 https://docs.typo3.org/typo3cms/TyposcriptReference/Conditions/Reference.html#extending-the-expression-language-with-own-functions-like-old-userfunc)
a) Write your own condition (see https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Conditions/Reference/Index.html#custom-conditions or starting with version 9 https://docs.typo3.org/typo3cms/TyposcriptReference/Conditions/Reference.html#extending-the-expression-language-with-own-functions-like-old-userfunc)
b) 使用 userFunc(例如a",只是较旧且不太花哨的 ;)) - 参见 https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Conditions/Reference/Index.html#userfunc
b) Use a userFunc (like "a" only older and less fancy ;)) - see https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Conditions/Reference/Index.html#userfunc
new c) 遵循 Jigals 的建议(或使用类似的扩展 - 有一些 - 但它们大多做的比你需要的要多得多)
new c) follow Jigals suggestion (or use a similar extension - there are a few - but they mostly do a lot more than what you need)
--- 问题更新后编辑---
--- EDIT after question update ---
如您所愿,它在 TSConfig c) 中工作实际上不是一种选择.
As you want it working in TSConfig c) is actually not an option.
c) 根据您实际想要实现的条件,直接在 TS 对象上使用 if 和 data(如您的描述中),如果您的条件为真,这些对象应该具有不同的行为.
c) depending on what you actually want to achieve with your condition use if and data (like in your description) directly at the TS objects that should have different behavior if your condition is true.
供参考:
TSConfig 条件和 TS 条件的区别:https://docs.typo3.org/typo3cms/TSconfigReference/8.7/Conditions/Index.html#differences-to-conditions-in-typoscript-templates
Differences between TSConfig Conditions and TS Conditions:https://docs.typo3.org/typo3cms/TSconfigReference/8.7/Conditions/Index.html#differences-to-conditions-in-typoscript-templates
这篇关于排版条件:backend_layout(带幻灯片)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!