在TypoScript Typo3-11.5中输出内联类型的字段时如何使用tt_content.uid?

问题描述 投票:0回答:1

我创建了一个扩展 tt_content 的国家/地区插件。在 setup.typoscript 中,我输出如下字段:

tt_content.countries {
    fields {
        content {
            fields {

                countries_text1 = TEXT
                countries_text1 {
                    field = countries_text1
                }

                countries_text2 = TEXT
                countries_text2 {
                    field = countries_text2
                }

                countries_repeater = COA
                countries_repeater {
                    10 = CONTENT
                    10 {
                        table = tx_countries_domain_model_repeater
                        select {
                            selectFields = title,country
                            pidInList.field = pid
                            where = parent_table='tt_content' AND parent_uid=422
                            orderBy = sorting
                        }
                        renderObj = COA
                        renderObj {
                            10 = TEXT
                            10 {
                                field = title
                                htmlSpecialChars = 1
                                wrap = {"title": "|"###BREAK###

                            }
                            20 = TEXT
                            20 {
                                field = country
                                htmlSpecialChars = 1
                                wrap = "country": "|"}###BREAK###
                            }
                        }
                        stdWrap.split {
                            token = ###BREAK###
                            cObjNum = 1 |*|2|*| 3
                            1 {
                                current = 1
                                stdWrap.wrap = [|
                            }
                            2 {
                                current = 1
                                stdWrap.wrap = ,|
                            }
                            3 {
                                current = 1
                                stdWrap.wrap = |]
                            }
                        }
                    }
                }
            }
        }
    }
}

而且它有效。它输出我需要的内容,但仅限于指定的parent_uid=422。你能告诉我如何用 tt_content 表中的 uid 替换“422”吗?

我尝试过parent_uid=current:uid、parent_uid=###data.uid###和parent_uid=###uid### with data = current:uid。但所有选项都会返回错误。

感谢您给我的任何提示。

typo3 typoscript typo3-11.x
1个回答
0
投票

TypoScript 在 marker

 下面具有 
select
 属性,您可以使用该属性在 WHERE 子句中插入值(并使用完整的 
stdWrap
属性)。

select {
    selectFields = title,country
    pidInList.field = pid
    where = parent_table='tt_content' AND parent_uid=###parentUid###
    markers {
        parentUid.data = current:uid
    }
    orderBy = sorting
}
© www.soinside.com 2019 - 2024. All rights reserved.