typo3typo3-7.x

Templates in TYPO3 extensions


I use TYPO3 v7.6.2! Create a custom extension. As the controller can select a template to generate? After the default, select the name_template = name_action.


Solution

  • Thank you, I found the answer to my question. In order to use different templates for the same extension, you just need to adjust the way in typoscript path to resources on the page where you need to.

    Constants:

    plugin.tx_plugin {
      view {
        templateRootPath = fileadmin/tx_plugin/you_custom_template
        partialRootPath = fileadmin/tx_plugin/you_custom_partial
        layoutRootPath = fileadmin/tx_plugin/you_custom_layout
      }
    }
    

    and setup:

    plugin.tx_plugin  {
      view {
        templateRootPaths.0 = {$plugin.tx_plugin.view.templateRootPath}
        partialRootPaths.0 = {$plugin.tx_plugin.view.partialRootPath}
        layoutRootPaths.0 = {$plugin.tx_plugin.view.layoutRootPath}
      }
    }