scarbous / mr_template
Adds the functionality to use a configuration file for TS-Config and TypoScript in your template-extension.
Installs: 146
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 1
Type:typo3-cms-extension
Requires
- php: ^7.3 || ^7.4 || ^8.0
- typo3/cms-core: ^10.4 || ^11
Requires (Dev)
- typo3/testing-framework: 6.15
Replaces
- typo3-ter/mr_template: 1.1.4
This package is auto-updated.
Last update: 2024-11-29 23:36:31 UTC
README
What does it do?
EXT:mr_template helps you to organize your TypoScript and TSConfig in your Template-Extension.
Why have I created this 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)
How to use?
-
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"
Folder structure
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
Default TypoScript and TSConfig
Here are some simple Configs I use realy often in Template-Extensions.
TypoScript
EXT:mr_template/Configuration/TypoScript/Page
Add FluidPage Template based on BackendLayout-Name.
EXT:mr_template/Configuration/TypoScript/BackendLayoutBodyClass
Like the folder name say, add the BackendLayout name as class to the body-tag.
EXT:mr_template/Configuration/TypoScript/Config
Some basic configs with configurable constants like:
- caching
- concatenateJs
- concatenateCss
- compressJs
- compressCss
TSConfig
Scarbous\MrTemplate\Template\Entity\BackendLayouts
Adds all BackendLayout files under EXT:[sample_extension\]/Configuration/TsConfig/Page/Mod/WebLayout/BackendLayouts