简体   繁体   English

将 static 模板添加到我的 typo3 扩展

[英]Add a static template to my typo3 extension

I have created an extension with sitepackagebuilder.com and the idea is just to write some static html.我用 sitepackagebuilder.com 创建了一个扩展,这个想法只是写一些 static html。 I know that when you have a controller you can call the templates by following the convention names.我知道,当您拥有 controller 时,您可以按照约定名称调用模板。 But what if you don't have a controller?但是,如果您没有 controller 怎么办? What I need, at least for now, is just to install the extension, add the plugin into a page and get some static content in that page.至少现在我需要的只是安装扩展,将插件添加到页面中并在该页面中获取一些 static 内容。 I can imagine that this is set in a typoscript file but I'm quite noob with all the typoscript thing.我可以想象这是在一个打字稿文件中设置的,但我对所有打字稿的东西都很陌生。

I'm getting this error: 'No Content Object definition found at TypoScript object path "tt_content.list.20.heboorganigram_organigram"'我收到此错误:'No Content Object 定义在 TypoScript object 路径“tt_content.list.20.heboorganigram_organigram”中找到

Until I define that object in my typoscript file.直到我在我的打字稿文件中定义了 object。 I have tried this.我试过这个。

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

And then I don't get an error but I also don't get the content from my Organigram.html, this is just trying stuffs, I actually don't know if this is what I need to do.然后我没有收到错误,但我也没有从我的 Organigram.html 中获得内容,这只是尝试的东西,我实际上不知道这是否是我需要做的。

Before creating new Content Elements you first have to create the Page Template, for that have a look at the sitepackage tutorial https://docs.typo3.org/m/typo3/tutorial-sitepackage/master/en-us/FluidTemplates/Index.html在创建新的内容元素之前,您首先必须创建页面模板,查看站点包教程https://docs.typo3.org/m/typo3/tutorial-sitepackage/master/en-us/FluidTemplates/Index .html

If you already got the page template, have a look at https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/ContentElements/AddingYourOwnContentElements.html如果你已经获得了页面模板,请查看https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/ContentElements/AddingYourOwnContent2C4B6A7110B50D807BADE5Z:

Provided you already did the steps above, for getting the frontend output you are interested in the step Configure the frontend rendering前提是您已经完成了上述步骤,获取前端 output 您对Configure the frontend rendering步骤感兴趣

So the TypoScript should look something like this:所以 TypoScript 应该看起来像这样:

lib.contentElement {
    templateRootPaths.200 = EXT:heboorganigram/Resources/Private/Templates/
}
tt_content {
    examples_newcontentelement =< lib.contentElement
    examples_newcontentelement {
        templateName = NewContentElement
    }
}

Then you need to place your Organigram.html file in the Templates Folder in inside the sitepackage.然后,您需要将 Organigram.html 文件放在站点包内的模板文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM