Skip to main content
Logo Marketing Factory Consulting GmbH
Contact
Logo Marketing Factory Consulting GmbH
  • Agency
    • Our work method
      • Team Sphinx
      • Team Phoenix
    • About us
    • History
  • Services
    • Consulting, Analysis and Strategy
    • Programming and Development
      • Interface Development
      • PIM/ERP Links
      • Custom Development
      • Seamless CMS Integration
    • Hosting and Support
      • Operation on our Colocation Hardware
      • Cloud Strategies
    • Services with Third Parties
  • Technology
    • TYPO3
    • Shopware
    • IT Security
      • DDoS Protection
      • Continuous Upgrading
      • Privacy First
    • Tech Stack
      • Commitment to Open Source
      • Technology Selection
      • PHP Ecosystem
      • Containerisation & Clustering
      • Content Delivery Networks
      • Search Technologies
  • References
    • Projects
    • Clients
      • Client List
    • New: Launch of Westfalia Shopware 6 Shop
  • Community
    • Community Initiatives
  • Blog
  • Careers
    • Job Openings
      • TYPO3 Developer (m/f/x)
      • Backend Developer (m/f/x)
      • System Administrator Linux (m/f/x)
      • Project manager (m/f/x)
  • Contact
  • Deutsch
  • English

You are here:

  1. Blog
  2. How to include all Static Templates with your TYPO3 sitepackage
TYPO3 Logo
  • Development
  • TYPO3
  • Tutorial
26.02.2019

How to include all Static Templates with your TYPO3 sitepackage


Show larger version for: Static Includes in the Template record: long list on both sided

What are Static Templates in TYPO3?

Static templates are TypoScript files that contain specific configurations. They are used, for example, to extend the appearance or behavior of an extension in TYPO3. To integrate these configurations into TYPO3, they have to be included via a template.

In practice, the whole thing usually looks something like this:

It is almost impossible not to get confused. The integration of the static templates often has to happen in a certain order, because the individual templates build on each other and therefore depend on each other.

Why do we include Static Templates via the sitepackage and not via the template record in TYPO3?

We at MFC work with the versioning system Git. Often enough, multiple employees will work on the same project but in different branches.

If one of the employees were to add an extension with a Static Template, every other employee would also have to adapt the static templates in their local development environment, when switching to the same branch. The same issue would also occur if the branch is deployed to a testing or staging system and another branch was previously deployed there.

Ergo: Unnecessary, multiple effort, as well as increased documentation requirements.

Show larger version for: TypoScript directory structure in sitepackage

How do we include all Static Templates with the sitepackage?

Update 01/2023: in the original blog post, we had loaded the includes in two separate TypoScript files. The new examples show our current way of working. We also removed the old include syntax of TYPO3 v8 from this tutorial.

The two files constants.typoscript and setup.typoscript are provided by the addStaticFile() method in our Sitepackage. Please refer to the official TYPO3 documentation for more details.

Depending on the project, the directory structure will look something like this:

constants.typoscript

######################
#### DEPENDENCIES ####
######################
@import 'EXT:bootstrap_package/Configuration/TypoScript/constants.typoscript'
@import 'EXT:blog/Configuration/TypoScript/Integration/constants.typoscript'
@import 'EXT:picturecredits/Configuration/TypoScript/constants.typoscript'
@import 'EXT:sg_cookie_optin/Configuration/TypoScript/Frontend/constants.typoscript'
@import 'EXT:bw_captcha/Configuration/TypoScript/constants.typoscript'
@import 'EXT:solr/Configuration/TypoScript/Solr/constants.typoscript'


########################
#### PROJECT CONFIG ####
########################
@import 'EXT:mfc_sitepackage/Configuration/TypoScript/Constants/*.typoscript'

setup.typoscript

######################
#### DEPENDENCIES ####
######################
@import 'EXT:bootstrap_package/Configuration/TypoScript/setup.typoscript'
@import 'EXT:blog/Configuration/TypoScript/Integration/setup.typoscript'
@import "EXT:typo3_encore/Configuration/TypoScript/setup.typoscript"
@import 'EXT:picturecredits/Configuration/TypoScript/setup.typoscript'
@import 'EXT:form_element_linked_checkbox/Configuration/TypoScript/setup.typoscript'
@import 'EXT:sg_cookie_optin/Configuration/TypoScript/Frontend/setup.typoscript'
@import 'EXT:bw_captcha/Configuration/TypoScript/setup.typoscript'
@import 'EXT:solr/Configuration/TypoScript/Solr/setup.typoscript'
@import 'EXT:yoast_seo/Configuration/TypoScript/setup.typoscript'


########################
#### PROJECT CONFIG ####
########################
// Elements
@import 'EXT:mfc_sitepackage/Configuration/TypoScript/Elements/01_Configuration.typoscript'
@import 'EXT:mfc_sitepackage/Configuration/TypoScript/Elements/02_Plugin.typoscript'
@import 'EXT:mfc_sitepackage/Configuration/TypoScript/Elements/10_PageTemplate.typoscript'

// Content Elements
@import 'EXT:mfc_sitepackage/Configuration/TypoScript/ContentElements/Helper/*.typoscript'
@import 'EXT:mfc_sitepackage/Configuration/TypoScript/ContentElements/*.typoscript'

// Extensions
@import 'EXT:mfc_sitepackage/Configuration/TypoScript/Extensions/*.typoscript'

Both in the TypoScript constants and the setup, we first include all extensions that are required in the project. These can be third-party extensions, but also project-specific custom developments.

Only then do we include the other, individual configurations from the sitepackage:

  • overwriting TS constants from third-party extensions
  • project-specific basic configurations
  • configuration of custom (content) elements
  • modification or addition of extension configurations
  • the PAGE setup (or overrides of an existing PAGE object, if you use solutions like the Bootstrap Package)
Show larger version for: Static Includes in Template record: only the sitepackage is included afterwards

At the end, only the Static Template of the sitepackage has to be loaded in the template record of TYPO3.

Et voilá: Instead of having to manage a complex, sequential sequence, all static templates can simply be included in one step.

Christian Hellmund
Get blog posts as RSS feed

Related blog posts

  • Improving TYPO3 Container elements
  • Automatic updates in our projects
  • TYPO3 and SAP Customer Data Cloud
  • Marketing Factory goes TYPO3 Version 11

Please feel free to share this article.


Comments

No comments yet.

Write a comment.

I have been informed that the processing of my data is on a voluntary basis and that I can refuse my consent without detrimental consequences for me or withdraw my consent at any time to Marketing Factory Consulting GmbH by mail (Marienstraße 14, D-40212 Düsseldorf) or e-mail (info@marketing-factory.de).

I understand that the above data will be stored for as long as I wish to be contacted by Marketing Factory. After my revocation my data will be deleted. Further storage may take place in individual cases if this is required by law.

  • Data privacy policy
  • Legal notice
  • Marketing Factory is a TYPO3 Solution Partner
  • Marketing Factory is a Gold Member of the TYPO3 Association
  • Marketing Factory is a Shopware Business Partner
    Picture Credits
    1. "TYPO3 Logo": TYPO3 Association
    2. "Static Includes in the Template record": © Marketing Factory Consulting GmbH
    3. "TypoScript directory structure in sitepackage": © Marketing Factory Consulting GmbH
    4. "Static Includes in Template record: sitepackage only": © Marketing Factory Consulting GmbH