问题描述
我用 sitepackagebuilder.com 创建了一个扩展,这个想法只是编写一些静态 html。 我知道当你有一个控制器时,你可以按照约定名称调用模板。但是如果你没有控制器怎么办?我需要的,至少现在,只是安装扩展,将插件添加到页面中并在该页面中获取一些静态内容。 我可以想象这是在一个打字稿文件中设置的,但我对所有打字稿的东西都很菜。
我收到此错误: '在 TypoScript 对象路径“tt_content.list.20.heboorganigram_organigram”中找不到内容对象定义'
直到我在我的排版文件中定义该对象。我试过了。
tt_content.list.20.heboorganigram_organigram = PAGE
tt_content.list.20.heboorganigram_organigram.10 = TEMPLATE //(or FLUIDTEMPLATE same result)
tt_content.list.20.heboorganigram_organigram.10.template = FILE
tt_content.list.20.heboorganigram_organigram.10.template.file = fileadmin/Organigram.html
然后我没有收到错误,但我也没有从我的 Organigram.html 中获取内容,这只是尝试的东西,我实际上不知道这是否是我需要做的。>
解决方法
在创建新的内容元素之前,您首先必须创建页面模板,为此请查看站点包教程 https://docs.typo3.org/m/typo3/tutorial-sitepackage/master/en-us/FluidTemplates/Index.html
如果您已经获得了页面模板,请查看https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/ContentElements/AddingYourOwnContentElements.html
如果您已经完成了上述步骤,那么为了获得您对步骤 Configure the frontend rendering
感兴趣的前端输出
所以 TypoScript 应该看起来像这样:
lib.contentElement {
templateRootPaths.200 = EXT:heboorganigram/Resources/Private/Templates/
}
tt_content {
examples_newcontentelement =< lib.contentElement
examples_newcontentelement {
templateName = NewContentElement
}
}
然后您需要将您的 Organigram.html 文件放在站点包内的模板文件夹中。