EXT:mr_template helps you to organize your TypoScript and TSConfig in your Template-Extension.
My goal when creating template extensions is to be able to reuse code easily and to configure as little as possible by hand.
With Mr.Template, I can create basic templates and build on them.
All TypoScripts and TSConfigs are loaded for the respective section of the page tree. (MultiPage support)
-
Basically download and install the extension.
It is recommended to install it with composer. -
Create your Template-Extension your with the [folder structure](#Folder structure):
-
Create a
template.yml
in your Template-Extension and add the config like:
label: Sample Template
parent: mr_template/base
typoScript:
- EXT:fluid_styled_content/Configuration/TypoScript
- EXT:news/Configuration/TypoScript
extensions: # Includes TypoScript in Extensions/[ExtsnsionName]/Configuration/TypoScript
- fluid_styled_content
- news
tsConfig: # Can handle TSConfig Files or classes wich implements Scarbous\MrTemplate\Template\Entity\TsConfigInterface
- EXT:sample_template/Configuration/TsConfig/Page/TCEMAIN.tsconfig
-
Define your "site root" and add one empty TypoScript Template to the "site root".
-
Select Template in Sites-Config under Tab "Mr.Template"
That the system can do the job your Template Extension needs the following folder structure:
sample_template
┣ Configuration
┃ ┣ MrTemplate
┃ ┣ default <- Template name, one Extension can handle multiple templates
┃ ┃ ┗ template.yml
┃ ┃
┃ ┗ TsConfig
┃ ┗ Page
┃ ┗ Mod
┃ ┗ WebLayout
┃ ┗ BackendLayouts <- Each BackendLayout get its one file.
┃ ┗ default.tsconfig
┃
┃ ┗ TypoScript <- Default TypoScript
┃ ┣ setup.txt
┃ ┗ constants.txt
┃
┣ Extensions <- Overrides for other extensions
┃ ┗ news
┃ ┗ Configuration
┃ ┗ TypoScript
┃ ┣ setup.txt
┃ ┗ constants.txt
┃
┗ Resources
┗ Private
┣ Layouts
┃ ┗ Page
┃
┣ Partials
┃ ┗ Page
┃
┗ Templates
┗ Page
Here are some simple Configs I use realy often in Template-Extensions.
Add FluidPage Template based on BackendLayout-Name.
Like the folder name say, add the BackendLayout name as class to the body-tag.
Some basic configs with configurable constants like:
- caching
- concatenateJs
- concatenateCss
- compressJs
- compressCss
Adds all BackendLayout files under EXT:[sample_extension\]/Configuration/TsConfig/Page/Mod/WebLayout/BackendLayouts