TYPO3 How to overwrite blog extension in custom extension

428 Views Asked by At

I tried this, in my extension's setup.typoscript. but is not work for me.

plugin.tx_blog {
    view {
        layoutRootPaths   = EXT:solution/Resources/Private/Extensions/Blog/Layouts/
        partialRootPaths  = EXT:solution/Resources/Private/Extensions/Blog/Partials/
        templateRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Templates/
   }

}

2

There are 2 best solutions below

3
On

all the "RootPaths" are arrays so change it to somting like this

plugin.tx_blog {
    view {
        layoutRootPaths.200   = EXT:solution/Resources/Private/Extensions/Blog/Layouts/
        partialRootPaths.200  = EXT:solution/Resources/Private/Extensions/Blog/Partials/
        templateRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Templates/
   }

the "200" in the examle is the position if Fluid is looking for a Resource (like a template) it will check every provided path in numerical order.

use the Typoscript Object Browser (in the Template Module) to check the configured RootPaths

0
On

The standard setup of that extension is a bit uncommon.
The easiest was to override the paths for fluid files is to use the constant editor. There you have fields where you can enter your own paths.

If you want to do it in the setup, you can look in the TypoScript setup of the extension that looks like shown below.

page = PAGE
page {
    typeNum = 0
    10 = FLUIDTEMPLATE
    10 {
        templateName = BlogList
        templateRootPaths {
            0 = EXT:blog/Resources/Private/Templates/Page/
            1 = {$page.fluidtemplate.templateRootPath}
        }
        partialRootPaths {
            0 = EXT:blog/Resources/Private/Partials/Page/
            1 = {$page.fluidtemplate.partialRootPath}
        }
        layoutRootPaths {
            0 = EXT:blog/Resources/Private/Layouts/Page/
            1 = {$page.fluidtemplate.layoutRootPath}
        }
        ...

So in a short block the the paths would look like this:

page.10.templateRootPaths {
    0 = EXT:blog/Resources/Private/Templates/Page/
    1 = {$page.fluidtemplate.templateRootPath}
}
page.10.partialRootPaths {
    0 = EXT:blog/Resources/Private/Partials/Page/
    1 = {$page.fluidtemplate.partialRootPath}
}
page.10.layoutRootPaths {
    0 = EXT:blog/Resources/Private/Layouts/Page/
    1 = {$page.fluidtemplate.layoutRootPath}
}

In the lines starting with 1 you can enter your own path if you never want to use the constants. For this you never have to enter it in the original TypoScript template, but just copy the block above in your own TypoScript and adjust the paths. If your TypoScript is loaded after that of the blog, it's overwriting the original values.

Take care that there exist different setups, one in each folder inside https://github.com/TYPO3GmbH/blog/tree/master/Configuration/TypoScript. So depending on the template you chose the setup must be different. But I hope you're able to adapt the way to go now.