如何按字段对记录排序

时间:2019-10-11 12:22:49

标签: typo3 typoscript typo3-9.x

我有一个页面,我在其中输出某些记录(而不是页面)中的预告片。我已经通过下面的打字稿意识到了这一点。该脚本通过流畅的脚本获取参数:

<f:for each="{data.tx_mask_cnt_nwsdat_teaser_rec}" as="data_item">
 <f:cObject typoscriptObjectPath="lib.dateteaser-man-x" data="{uid: data_item.uid, recid: data_item.records}"/>
</f:for>

变量“ recid”包含记录中的ID,应从中生成预告片。这可以按预期的方式工作-记录将按照ID在“ recid”中的顺序进行排序,但是现在我想按“ tx_mask_cnt_textpic_uni_date”字段对记录进行排序-我该如何实现?

lib.dateteaser-man-x {

    wrap = |

    10 = RECORDS
    10 {

        source.data = field:recid  // --> comma separated list of record-ids

        dontCheckPid = 1
        tables = tt_content

        conf.tt_content = COA
        conf.tt_content {

            wrap = <div class="teaserbox-item-wrapper">|</div>

            # Datum / Symbol
            10 = CASE
            10 {
                key.field = tx_mask_cnt_textpic_uni_teaserlabel

                1 = COA
                1 {

                    wrap = <div class="tb-labelfield">|</div>

                    10 = TEXT
                    10 {
                        wrap = <span class="tb-date day">|</span>
                        field = tx_mask_cnt_textpic_uni_date  // --> field to sort by (format YYY-MM-DD)
                        strtotime = 1
                        strftime = %e
                    }

                    20 = TEXT
                    20 {
                        wrap = <span class="tb-date monthyear">|</span>
                        field = tx_mask_cnt_textpic_uni_date
                        strtotime = 1
                        strftime = %b. %y
                    }

                }

                2 = TEXT
                2 {
                    wrap = <div class="tb-labelfield">|</div>
                    value = <span class="tb-info"><i data-feather="info"></i></span>
                }

                default = TEXT
                default {
                    wrap = <div class="tb-labelfield">|</div>
                    value = <span class="tb-info"><i data-feather="info"></i></span>
                }

            }

            # Text
            30 = TEXT
            30 {
                wrap = <div class="tb-content">|</div>
                field = tx_mask_cnt_textpic_uni_teasertxt
            }

        }

    }

} 

在此先感谢您的帮助!

Typo3 V.9.5.8

1 个答案:

答案 0 :(得分:0)