TYPO3 TypoScript如果相等则隐藏

时间:2017-05-09 19:07:54

标签: typo3 typoscript typo3-7.6.x

我尝试仅在与start_date不同时才显示end_date。使用此代码,end_date始终隐藏。

temp.title = COA
temp.title {
    10 = RECORDS
    10 {
        source = {GP:tx_myextension_event|event}
        source.insertData = 1
        tables = tx_myextension_domain_model_event
        conf.tx_myextension_domain_model_event = TEXT
        conf.tx_myextension_domain_model_event {
            if.field = end_date
            if.equals.field = start_date
            if.negate = 1
        }
    }
}

2 个答案:

答案 0 :(得分:0)

如果要显示end_date,则需要:

temp.title = COA 
temp.title {
    10 = RECORDS
    10 {
        source = {GP:tx_myextension_event|event}
        source.insertData = 1
        # Parse data to integer
        source.intval = 1
        tables = tx_myextension_domain_model_event
        conf.tx_myextension_domain_model_event = TEXT
        conf.tx_myextension_domain_model_event {
            # You need this to show the end_date
            field = end_date
            if.equals.field = start_date
            if.field = end_date
            if.negate = 1
        }
    }
}

答案 1 :(得分:0)

这有效

temp.title = COA
temp.title {
    ...
    40 = RECORDS
    40 {
        source = {GP:tx_myextension_event|event}
        source.insertData = 1
        tables = tx_myextension_domain_model_event
        conf.tx_myextension_domain_model_event = TEXT
        conf.tx_myextension_domain_model_event {
            field = end_date
            if.value.field = end_date
            if.isLessThan.field = start_date
            strftime = %d.%m.%Y
        }
        stdWrap.noTrimWrap = | - ||
        stdWrap.required = 1
    }
}