templatestsconfigtx-newstypo3-11.x

issue with Template selector


I'm using Typo3 in version 11.5.19 with the News plugin and bootstrap extension. So far, I had a lot of trouble to implement some customisations into a site package: none of my customisations would work at all. So currently I am coding all customisations directly into the extension files (it's only a handful files with minor adaptations in bootstrap and some partials in news extension to have a similar desing).

For the very last customisation I need to do, does require the Template selector in the News extensions. Unfortunately, I followed the steps in the tutorial but the template layout selector remains emtpy when I want to choose a custom design for a specific page content element. The HTML partial files should be ok, while there is no "oops, there went something wrong" message.

I used the following code in the Page Template:

plugin.tx_news.templateLayouts {
  91 = TopNews2
  92 = Related4
  93 = Presse1
}

screenshot of emtpy selector

I am not sure if the Page Template is the right place to put the code in, but I tried several other options (TS config files in different places like extensions) but I didn't work out. Even an own site package containing a page TsConfig was of no help.

Does anyone know how to solve this? I am new to Typo3 to be honest...


Solution

  • I think you have mixed up a lot of different errors.

    You need to identify where which configuration is needed to get your desired behaviour. It could be difficult as some terms with TYPO3 are difficult to differ for beginners.

    Adding template layouts:

    You wrote you use the page template, but you need to use the page TSconfig. As easiest case this is could be a field in the page properties (other options would be include files, or configuration from an (own) extension): in the tab Resources the field Page TSconfig [TSconfig]. That's the place for adding template layouts as written in the manual. (and there it is tx_news.templateLayouts without plugin., which belongs to another configuration of ext:news)

    customisations directly into the extension files:

    I assume you missed to insert the path to your (FLUID) templates, so that your (FLUID) templates are preferred to the extension (FLUID) templates.

    Therefore you need to insert some TypoScript to the constant part of the (configuration) templates as described in the manual (here the plugin. is correct):

    plugin.tx_news {
       view {
          templateRootPath = EXT:mysitepackage/Resources/Private/Extensions/News/Templates/
          partialRootPath = EXT:mysitepackage/Resources/Private/Extensions/News/Partials/
          layoutRootPath = EXT:mysitepackage/Resources/Private/Extensions/News/Layouts/
       }
    }
    

    These paths needs to be defined as constants to be inserted afterwards in the setup section of your (configuration template) with higher priority than the default paths. (get informed to the topic "paths for FLUID templates")

    The Constant Editorcould be a tool to insert the correct configuration for these paths
    (category PLUGIN.TX_NEWS -> section 'FILES')