如何将所有 categorie-titles 连接到它的记录

How to put out a record with all categorie-titles connected to it

在网站上,要输出各种记录作为预告片。每条记录都分配给一个或多个类别。在预告片中,应显示分配给相应记录的所有类别的标题。

我用 Typoscript 尝试了这个(见下文),其中我通过 JOIN 与 sys_category 和 sys_category_record_mm 链接了 tt_content 的数据库查询。

但是现在对于分配了多个类别的记录,相应的预告片会输出多次,即每个类别一次。

流体:

<f:if condition="{data.tx_mask_cnt_mag_teaser_records}">
    <f:for each="{data.tx_mask_cnt_mag_teaser_records}" as="data_item">
        <f:cObject typoscriptObjectPath="lib.magteaser" data="{dsuid: data_item.uid, recid: data_item.records, reclimit: 2, tstype: 1, syscats: data.tx_mask_cnt_mag_teaser_cats}" />
    </f:for>
</f:if>

错别字:

lib.magteaser = COA
lib.magteaser {

    wrap = |

    5 = LOAD_REGISTER
    5 {
        dTstype.data = field:tstype  // Different Teaser-Types
        dSyscats.data = field:syscats  // List of all categories to consider
    }

    10 = CONTENT
    10 {
        table = tt_content
        select {
            pidInList = 13  // Folder in which the records are stored
            uidInList.data = field:recid
            recursive = 2

            selectFields.dataWrap = *, FIND_IN_SET(`tt_content`.`uid`,'{field:recid}') AS reclist_sortby
            join = sys_category_record_mm ON (sys_category_record_mm.uid_foreign = tt_content.uid) JOIN sys_category ON (sys_category_record_mm.uid_local = sys_category.uid)

            where = tt_content.hidden=0
            where = tt_content.CType='mask_cnt_textpic_uni'

            where.data = field:syscats
            # where.intval = 1
            where.wrap = sys_category_record_mm.uid_local IN (|)

            orderBy = reclist_sortby
        }

        renderObj = COA
        renderObj {

            5 = LOAD_REGISTER
            5 {
                # Count variable for a CASE (see below) to format the first data record differently from the remaining data records.
                dsCounter.stdWrap.dataWrap = {register:dsCounter} + 1
                dsCounter.prioriCalc = intval
            }

            10 = CASE
            10 {
                key.data = register:dTstype

                default = COA
                default {
                    wrap = <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 magteaser-std">|</div>
                    [...]
                }

                # 1 Titelbild und 2 Standard-Teaser
                1 = COA
                1 {
                    wrap = <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 magteaser-std">|</div>
                    [...]
                }

                # 1 Top-Teaser und 2 Standard-Teaser
                2 = COA
                2 {

                    10 = CASE
                    10 {
                        key.data = register:dsCounter

                        # Standard-Teaser
                        default = COA
                        default {
                            wrap = <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 magteaser-std">|</div>

                            10 = TEXT
                            10 {
                                wrap = Kategorie (def): |
                                value.dataWrap = {field:title}
                            }

                            [...]

                        }

                        # Top-Teaser
                        1 = COA
                        1 {
                            wrap = <div class="col-12 magteaser-top">|</div>

                            10 = TEXT
                            10 {
                                wrap = Kategorie (1): |
                                value.dataWrap = {field:title}
                            }

                            [...]

                        }

                    }

                }

            }

        }

    }

}

有人能告诉我如何解决这个问题吗? 非常感谢您的帮助!

Typo3 V.9.5.8

通过连接生成一个矩阵,每个组合都有一个 'record'。

正确的处理方式是处理 renderObj 中的多个类别:
构建一个部件,打印此 tt_content 记录的所有类别。

概念结构:

10 = CONTENT
10 {
    table = tt_content
    select {
          :
          // without JOIn
          :
    }

    renderObj = COA
    renderObj {

        :

        50 = CONTENT
        50 {
            table = sys_categories
            SELECT {
                join = sys_category_record_mm ON (sys_category_record_mm.uid_foreign = ###CONTENT_UID###) AND (sys_category_record_mm.uid_local = sys_category.uid)

                markers {
                    // context is current tt_content record:  
                    CONTENT_UID.field = uid
                }
            }
            renderObj = TEXT
            renderObj.field = title
            renderObj.wrap =  || ,|
        }
    }
}