TYPO3:条件“如果列空”?

时间:2016-02-26 11:15:56

标签: typo3 conditional-statements typoscript

我正在寻找一个条件来检查某个列是否为空。

这样的事情:

[colPos.0 = empty]
#do stuff
[global]

提前致谢。

编辑:
我认为目前尚不清楚我在寻找什么。所以让我添加一些信息:

我在BE(colPos = 0)中有一个预告片图像列。如果它包含一个元素,它应该定期显示该元素。如果不是(==如果为空),则应使用另一个图像。

2 个答案:

答案 0 :(得分:0)

当然有可能显示某列是否包含内容, 但是没有TS条件。

基于https://kuttler.eu/en/post/change-template-if-content-exists-in-typo3/
这是我的解决方案:

temp.foo {
temp.foo = COA

    10 = COA
    10 {
        10 < styles.content.get
        10.select.where = colPos=1

        # conditional to test if content exists in column
        if.isTrue.numRows {
            # check current page page
            pidInList = this
            # in the table tt_content
            table = tt_content
            # colPos = 1
            select.where = colPos=1
        }
    }

    20 = COA
    20 {
        10 < lib.somethingElse

        # conditional to test if content exists in column
        if.isFalse.numRows {
            # check current page page
            pidInList = this
            # in the table tt_content
            table = tt_content
            # colPos = 1
            select.where = colPos=1
        }
    }
} 

if.isTrueif.isFalse正在解决问题。

HTH

答案 1 :(得分:-1)

您可以使用if function,示例(来自doc):

page.10 = COA_INT
page.10.10 = TEXT
page.10.10 {
  stdWrap.if.isNull.field = description
  value = No description available.
}

编辑:此外,如果您使用的是Fluid模板,则可以使用f:if条件。

相关问题