简体   繁体   中英

TYPO3 tx_news extension not using override template

I have two sites using the tx_news extension. As far as I can tell they are set up identically. On site AI have added a new List.html partial and it works as expected. On site B however it is completely ignoring my List override.

I have triple checked the file path to make sure the typoscript points to the right place but it still uses the default. What could be wrong here?

plugin.tx_news {
  view {
    templateRootPaths >
    templateRootPaths {
      0 = EXT:news/Resources/Private/Templates/
      1 = fileadmin/templates/example/news/Templates/
    }
    partialRootPaths >
    partialRootPaths {
      0 = EXT:news/Resources/Private/Partials/
      1 = fileadmin/templates/example/news/Partials/
    }
    layoutRootPaths >
    layoutRootPaths {
      0 = EXT:news/Resources/Private/Layouts/
      1 = fileadmin/templates/example/news/Layouts/
    }
  }
}

To make it work as expected I would do the following:

1) Copy the three folders from ext/news/Resources/Private/Templates, Partials, Layouts to fileadmin/templates/example/news (I believe you have already done that)

2) Then place this in to your template provider or page typoscript constants :

plugin.tx_news {
    view {
        templateRootPath = fileadmin/templates/example/news/Templates/
        partialRootPath = fileadmin/templates/example/news/Partials/
        layoutRootPath = fileadmin/templates/example/news/Layouts/
    }
}

Now the news extension will use the Template files placed in fileadmin/

Next step would be to add some pageTSConfig inside your root pages properties in case you need more flexibility. For example like this:

tx_news.templateLayouts {
    1 = Special List Item
    2 = Special Detail Layout
}

That allows you to select one of these template layouts in your news plugin and to use conditions in your template file:

<f:if condition="{settings.templateLayout} == 1">
    <f:then>
        <!-- markup for a special list item -->
    </f:then>
    <f:else>
        <!-- markup for another list item -->
    </f:else>
</f:if>

Your script looks good. When something like this happens in TYPO3 there is an option to check whatever your TypoScript valid or this changes are really added into the right place.

Go into the BE, select the Template module and with the TypoScript Object Browser you can see if in your Setup every changes are there or not. (Or if you may have a syntax error)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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