Search code examples
typoscripttypo3-9.xtypo3-extensions

Adding backend content to Typo3 extension template


I have created a Typo3 Extension and added some .html Pages to my template folders, which I prefilled with hardcoded HTML Code. Then I added my settings to my setup.typoscript

page = PAGE
page {
    typeNum = 0
    shortcutIcon = ""
    // Part 1: Fluid template section
    10 = FLUIDTEMPLATE
    10 {
        templateName = TEXT
        templateName.stdWrap.cObject = CASE
        templateName.stdWrap.cObject {
            key.data = pagelayout
            pagets__tjms_default = TEXT
            pagets__tjms_default.value = Main-Template
            pagets__2 = TEXT
            pagets__2.value = Start-Content
            pagets__3 = TEXT
            pagets__3.value = Tutorial-Content
            pagets__4 = TEXT
            pagets__4.value = Assistent-Content
            default = TEXT
            default.value = Main-Template
        }
        templateRootPaths {
            0 = EXT:tjms/Resources/Private/Templates/Page/
            1 = {$page.fluidtemplate.templateRootPath}
        }
        partialRootPaths {
            0 = EXT:tjms/Resources/Private/Partials/Page/
            1 = {$page.fluidtemplate.partialRootPath}
        }
        layoutRootPaths {
            0 = EXT:tjms/Resources/Private/Layouts/Page/
            1 = {$page.fluidtemplate.layoutRootPath}
        }
    }

I've added the pages in the Typo3 Backend and activated my plugin. Now I'm able to see the content that is coming from my .html Files, which is nice. But here comes my problem. In my Typo3 Backend, I also want to add dynamic Content to my pages, but anytime I do that, this content isn't showing up on my page, even though I add it specifically to the page. Only the hardcoded .html Code is being shown to me, but nothing I add in the backend pops up anywhere.

So my question would be if I have to configure my extension somehow or add stuff to my html templates, so that they show the content in the backend?

I'm using Typo3 9.5.14.

Thanks for any help!

enter image description hereenter image description here


Solution

  • Aside of an template you need variables to dynamically fill in content into that FLUID template.

    You need to use the variables in your template like {content} (or {content->f:format.raw()}) and you need to fill these varaibles like:

    page {
        10 {
            variables {
                content < styles.content.get
    
                test = TEXT
                test.value = my text from typoscript.
                test.wrap = <p>|</p>
            }
        }
    }
    

    or you use a viewhelper to get content from a column like this viewhelper call from EXT:bootstrap_package:

    <f:cObject typoscriptObjectPath="lib.dynamicContent" data="{pageUid: defaultPage, colPos: '0'}" />