首页 > 解决方案 > Typo3 V9 从整个页面中选择随机 DCE 显示在特定页面上

问题描述

我有一个自己的 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
            }

标签: typo3typoscripttypo3-9.xtx-dce

解决方案


你可以使用:

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

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


推荐阅读