Search code examples
typo3typoscriptfluid

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. I know that when you have a controller you can call the templates by following the convention names. But what if you don't have a 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. 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"'

Until I define that object in my typoscript file. 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.


Solution

  • 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

    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

    Provided you already did the steps above, for getting the frontend output you are interested in the step Configure the frontend rendering

    So the TypoScript should look something like this:

    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.