Typo3 如何将值从流体页面模板传递到ext:mask内容元素模板?
在TYPO3 7 LTS with ext:mask中,我想将一个值从我的页面模板传递到通过mask扩展呈现的FLUIDTEMPLATE中 我正在努力实现的一个例子: 内容元素包含描述汽车的内容:沃尔沃、四轮驱动 在页面模板中,我想以不同的方式显示“car” 颜色。因此页面模板可以命令:“获取第一个 汽车,并显示为绿色。然后第二辆汽车,并显示为黄色”。 (不,这与css无关.) 如果必须在整个页面上执行一次,我可以使用Typo3 如何将值从流体页面模板传递到ext:mask内容元素模板?,typo3,typoscript,fluid,typo3-7.6.x,tx-mask,Typo3,Typoscript,Fluid,Typo3 7.6.x,Tx Mask,在TYPO3 7 LTS with ext:mask中,我想将一个值从我的页面模板传递到通过mask扩展呈现的FLUIDTEMPLATE中 我正在努力实现的一个例子: 内容元素包含描述汽车的内容:沃尔沃、四轮驱动 在页面模板中,我想以不同的方式显示“car” 颜色。因此页面模板可以命令:“获取第一个 汽车,并显示为绿色。然后第二辆汽车,并显示为黄色”。 (不,这与css无关.) 如果必须在整个页面上执行一次,我可以使用 `tt_content.default.mask_car.settings.
`tt_content.default.mask_car.settings.color = green`
或者(记录在案),如果该变量的目的是修改演示文稿,我可以使用:
`tt_content.default.mask_car.settings.file = path/to/Mask/Content/Templates/car_green.html`
但是如果页面上有多个相同内容元素的实例,那么这种方法是不好的
如何将不同的值传递到页面上相同CE的不同实例中?您可以添加以下打字脚本:
lib.set_register = LOAD_REGISTER
lib.set_register.color = TEXT
lib.set_register.color.current = 1
lib.get_register.color = TEXT
lib.get_register.color.data = register:color
lib.mask_car < styles.content.get
lib.mask_car.select.where = colPos=123
lib.set\u register=LOAD\u register
lib.set\u register.color=文本
lib.set_register.color.current=1
lib.get\u register.color=文本
lib.get\u register.color.data=寄存器:颜色
lib.mask\u car
在页面模板中,您可以使用流体设置颜色
<f:cObject typoscriptObjectPath="lib.set_register.color" data="green"/>
<f:cObject typoscriptObjectPath="lib.mask_car"/>
<f:if condition="{f:cObject(typoscriptObjectPath: 'lib.get_register.color')} == 'green'">
<f:then>
green
</f:then>
<f:else>
not green
</f:else>
</f:if>
使用流体获取内容元素
<f:cObject typoscriptObjectPath="lib.set_register.color" data="green"/>
<f:cObject typoscriptObjectPath="lib.mask_car"/>
<f:if condition="{f:cObject(typoscriptObjectPath: 'lib.get_register.color')} == 'green'">
<f:then>
green
</f:then>
<f:else>
not green
</f:else>
</f:if>
并用流体切换遮罩模板中的内容元素
<f:cObject typoscriptObjectPath="lib.set_register.color" data="green"/>
<f:cObject typoscriptObjectPath="lib.mask_car"/>
<f:if condition="{f:cObject(typoscriptObjectPath: 'lib.get_register.color')} == 'green'">
<f:then>
green
</f:then>
<f:else>
not green
</f:else>
</f:if>
绿色
不是绿色的
我希望这能帮助您解决问题。您可以添加以下打字稿:
lib.set_register = LOAD_REGISTER
lib.set_register.color = TEXT
lib.set_register.color.current = 1
lib.get_register.color = TEXT
lib.get_register.color.data = register:color
lib.mask_car < styles.content.get
lib.mask_car.select.where = colPos=123
lib.set\u register=LOAD\u register
lib.set\u register.color=文本
lib.set_register.color.current=1
lib.get\u register.color=文本
lib.get\u register.color.data=寄存器:颜色
lib.mask\u car
在页面模板中,您可以使用流体设置颜色
<f:cObject typoscriptObjectPath="lib.set_register.color" data="green"/>
<f:cObject typoscriptObjectPath="lib.mask_car"/>
<f:if condition="{f:cObject(typoscriptObjectPath: 'lib.get_register.color')} == 'green'">
<f:then>
green
</f:then>
<f:else>
not green
</f:else>
</f:if>
使用流体获取内容元素
<f:cObject typoscriptObjectPath="lib.set_register.color" data="green"/>
<f:cObject typoscriptObjectPath="lib.mask_car"/>
<f:if condition="{f:cObject(typoscriptObjectPath: 'lib.get_register.color')} == 'green'">
<f:then>
green
</f:then>
<f:else>
not green
</f:else>
</f:if>
并用流体切换遮罩模板中的内容元素
<f:cObject typoscriptObjectPath="lib.set_register.color" data="green"/>
<f:cObject typoscriptObjectPath="lib.mask_car"/>
<f:if condition="{f:cObject(typoscriptObjectPath: 'lib.get_register.color')} == 'green'">
<f:then>
green
</f:then>
<f:else>
not green
</f:else>
</f:if>
绿色
不是绿色的
我希望这能帮助您解决问题。我也遇到过类似的问题:
掩码内容元素的集合;同一页面上相同元素的两种不同呈现:
- 一个随机掩码ce呈现为摘要,链接到页面底部的详细信息
- 呈现为列表项的所有遮罩ce的列表(详细信息) 我的解决方案:
lib.qa_random_teaser_community < styles.content.get
lib.qa_random_teaser_community.select{
where = colPos=12
pidInList = {$pidCommunityQAStorage}
max = 1
orderBy = rand()
}
在遮罩模板中,我只需检查设置并触发适当的渲染:
renderObj.default.mask_qa_community.settings.renderListItems = 1
<f:if condition="{settings.renderListItems}">
<f:then>
<f:render section="qa-detail" arguments="{data:data}"/>
</f:then>
<f:else>
<f:render section="qa-teaser" arguments="{data:data}"/>
</f:else>
</f:if>
在3.0.1版中键入3.8
renderObj.mask_qa_community.settings.file = .......
希望对其他人有用。我也有类似的问题:
掩码内容元素的集合;同一页面上相同元素的两种不同呈现:
- 一个随机掩码ce呈现为摘要,链接到页面底部的详细信息
- 呈现为列表项的所有遮罩ce的列表(详细信息) 我的解决方案:
lib.qa_random_teaser_community < styles.content.get
lib.qa_random_teaser_community.select{
where = colPos=12
pidInList = {$pidCommunityQAStorage}
max = 1
orderBy = rand()
}
在遮罩模板中,我只需检查设置并触发适当的渲染:
renderObj.default.mask_qa_community.settings.renderListItems = 1
<f:if condition="{settings.renderListItems}">
<f:then>
<f:render section="qa-detail" arguments="{data:data}"/>
</f:then>
<f:else>
<f:render section="qa-teaser" arguments="{data:data}"/>
</f:else>
</f:if>
在3.0.1版中键入3.8
renderObj.mask_qa_community.settings.file = .......
希望它对其他人有用。我正在重新讨论这个问题,在带有mask 4.x的TYPO3 9中,它的作用是:
lib.my_content_element {
renderObj.mask_content_text.settings.test = 123
}
我将再次讨论这个问题,在带有mask 4.x的TYPO3 9中,这是有效的:
lib.my_content_element {
renderObj.mask_content_text.settings.test = 123
}
呜呜!我已经测试过了,效果非常好,谢谢!呜呜!我已经测试过了,效果非常好,谢谢!我不知道如何完全切换模板文件。不确定它是否仍然有效。我不知道如何完全切换模板文件。不确定它是否仍然有效。