Attention
TYPO3 v10 has reached end-of-life as of April 30th 2023 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
Base Variants¶
In Site Handling base variants represent different bases for a web site depending on a specified
condition. For example a "live" base URL might be https://example.org but on local machine
it's https://example.localhost as a domain - that's when variants are used.
Base variants exist for languages, too. Currently these can only be defined
through the respective *.yml file, there is no UI available yet.
Variants consist of two parts:
a base to use for this variant
a condition that decides when this variant shall be active
Conditions are based on Symfony Expression Language and allow flexible conditions. For example:
applicationContext == "Development"
would define a base variant to use in Development context.
Note
Notice that environment variables can be used in the base via %env(...)%.
condition needs getenv(...) instead.
A configured base variant for development context.¶
Hint
For those coming from earlier TYPO3 versions: With site handling, there is
no need for sys_domain records anymore!
See also
Read Application Context for more information on how to set the application context.
Read YAML API for more information on YAML parsing.
The following variables and functions are available in addition to the default Symfony functionality:
Example¶
rootPageId: 1
base: 'https://example.org/'
baseVariants:
  -
    base: 'https://example.localhost/'
    condition: 'applicationContext == "Development"'
  -
    base: 'https://staging.example.org/'
    condition: 'applicationContext == "Production/Sydney"'
  -
    base: 'https://testing.example.org/'
    condition: 'applicationContext == "Testing/Paris"'
languages:
  -
    title: 'Global'
    enabled: true
    languageId: '0'
    base: /
    typo3Language: default
    locale: en_UK.UTF-8
    iso-639-1: en
    navigationTitle: English
    hreflang: gb-en
    direction: ''
    flag: gb
  -
    title: 'DE'
    enabled: true
    languageId: '1'
    base: https://example.de/'
    baseVariants:
      -
        base: 'https://de.example.localhost/'
        condition: 'applicationContext == "Development"'
      -
        base: 'https://staging.example.de/'
        condition: 'applicationContext == "Production/Sydney"'
      -
        base: 'https://testing.example.de/'
        condition: 'applicationContext == "Testing/Paris"'
    typo3Language: de
    locale: de_DE.UTF-8
    iso-639-1: de
    navigationTitle: Deutsch
    hreflang: de-de
    direction: ''
    fallbackType: strict
    flag: de
Properties¶
typo3.version¶
- Datatype
 string
- Description
 The current TYPO3 version
- Example
 11.5.0
typo3.branch¶
- Datatype
 string
- Description
 The current TYPO3 branch
- Example
 11.5
typo3.devIpMask¶
- Datatype
 string
- Description
 The configured devIpMask taken from
$GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']- Example
 77.176.160.*
applicationContext¶
- Datatype
 string
- Description
 The current application context
- Example
 Development
Functions¶
All functions from TYPO3s DefaultFunctionsProvider are available:
ip¶
- Datatype
 string
- Description
 Match an IP address, value or regex, wildcards possible. Special value:
devIpfor matchingdevIpMask.- Example
 ip("77.176.160.*")
compatVersion¶
- Datatype
 string
- Description
 Match a TYPO3 version
- Example
 compatVersion("11.5.0"),compatVersion("11.4")
like¶
- Datatype
 string
- Description
 Comparison function to compare two strings. The first parameter is the "haystack", the second the "needle". Wildcards are allowed.
- Example
 like("foobarbaz", "*bar*")
getenv¶
- Datatype
 string
- Description
 Wrapper for PHPs
getenv()function. Allows accessing environment variables.- Example
 getenv("TYPO3_BASE_URL")
date¶
- Datatype
 string
- Description
 Get the current date in given format.
- Example for checking the current month
 date("j") == 7
feature¶
- Datatype
 string
- Description
 Check whether a feature ("feature toggle") is enabled in TYPO3.
- Example
 feature("TypoScript.strictSyntax")
traverse¶
- Datatype
 array and string
- Description
 This function has two parameters: - first parameter is the array to traverse - second parameter is the path to traverse Syntax.
- Example
 traverse(request.getQueryParams(), 'tx_news_pi1/news') > 0