0

我有一个自己的 DCE 元素,我想在起始页上显示一个随机元素。当我通过and
选择 CType 时,我必须输入一个. 但我想要整个站点的 CE,而不是特定的 uid。 10 = CONTENTselectpidInList

我如何在 sql 语句中禁用它?

我当前的代码:

        10 = CONTENT
        10 {
            table = tt_content
            select {
                selectFields = *, rand() as virt_rnd
                pidInList = *
                where = colPos=0 and CType=dce_ref
                max = 1
                orderBy = virt_rnd
                languageField = sys_language_uid
            }
4

2 回答 2

0

你可以使用:

  select {
    selectFields = *
    pidInList = root
    recursive = 10
    orderBy = rand()
    where = colPos=0 and CType=dce_ref
    max = 1
    languageField = sys_language_uid
  }

使用根页面 (uid = 0) 和 10 级深度的所有页面(如果您的页面树更深,则使用更多)

于 2020-04-14T14:30:56.080 回答
0

Typo3 v10 的更新

排版:

lib.randomDCE = CONTENT
lib.randomDCE {
    table = tt_content
    select {
        pidInList = 1  // root page id
        recursive = 10
        where = {#colPos}=0 AND {#CType}='my_custom_element'
        max = 1
        languageField = sys_language_uid
        //orderBy = rand()    - does not work :-(
    }
}

在流体模板中使用:

<f:cObject typoscriptObjectPath="lib.randomDCE" />
于 2021-09-24T03:42:59.333 回答