如何在TYPO3 \ CMS \ Frontend \ DataProcessing \ DatabaseQueryProcessor中使用幻灯片

时间:2019-08-20 13:47:11

标签: typo3 typoscript

我不能在TYPO3 \ CMS \ Frontend \ DataProcessing \ DatabaseQueryProcessor中使用CONTENTs幻灯片

if (this.beforeExistingAdvisors) {
   advised.addAdvisor(0, this.advisor);
}

我希望幻灯片可以在TYPO3 \ CMS \ Frontend \ DataProcessing \ DatabaseQueryProcessor中工作,但不起作用。

为什么不起作用?看起来好像没有实现。

如何轻松实现CONTENT幻灯片行为?

2 个答案:

答案 0 :(得分:0)

您不能在DatabaseQueryProcessor中使用幻灯片,但可以编写自己的数据处理器。

您可以使用以下印刷文字。这应该在 contentrightcolumn 中为您提供相同的结果。也许这不是最好的解决方案,但您会得到结果。

page {
    1 {
        dataProcessing {
            # Content inside right column
            1 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
            1 {
                table = tt_content

                uidInList {
                    # this cObject creates a csv of all contents inside your colPos 1
                    cObject = CONTENT
                    cObject {
                        table = tt_content
                        slide = -1
                        select.where = colPos = 1
                        select.orderBy = sorting

                        renderObj = TEXT
                        renderObj {
                            field = uid
                            wrap = |,
                        }
                    }

                    stdWrap.substring = 0,-1
                }

                where = colPos = 1
                # otherwise the sorting would be wrong
                orderBy = sorting
                # considering the uid of you root page is 1
                pidInList = 1
                # depth of levels inside your pagetree
                recursive = 5

                as = contentrightcolumn
            }
        }
    }
}

答案 1 :(得分:0)

TypoScript中有不同的概念。

一个概念是 ENRICH 数据,然后使用FLUIDTEMPLATE进行渲染。这是使用DataProcessors完成的。

但是还有另一种方法 ADD 将数据添加到FLUIDTEMPLATE。此选项称为variables。变量可能与附加到单个FLUIDTEMPLATE的数据处理器一样多。

如果您想在FLUIDTEMPLATE中输出渲染的内容,我可以使用一个变量:

page {
    1 {
        variables {
            contentrightcolumn = CONTENT
            contentrightcolumn {
                table = tt_content
                slide = -1
                select {
                    where = colPos = 1
                }
            }
        }
    }
}

这提供了一个新变量,其中包含呈现的HTML。可以使用以下命令完成输出:

{contentrightcolumn -> f:format.raw()}

可能会打开XSS问题,具体取决于渲染链。但是在大多数情况下,这应该是解决方案。

也:

{contentrightcolumn -> f:format.html()}

是可能的,但由于某些标记可​​能会被修改,因此可能不会引起您的期望。

https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/ContentObjects/Fluidtemplate/Index.html