Base variants
In site handling, "base variants" represent different bases for a website
depending on a specified condition. For example, a "live" base URL might be
https://, but on a local machine it is
https:// as a domain - that is when variants are used.
Base variants exist for languages, too. Currently, these can only be defined
through the respective *. file, there is no backend user interface
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
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_ 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"'
  - base: '%env("TYPO3_BASE")%'
    condition: 'getenv("TYPO3_BASE")'
languages:
  - title: English
    enabled: true
    locale: en_US.UTF-8
    base: /
    websiteTitle: ''
    navigationTitle: English
    flag: gb
    languageId: 0
  - title: Deutsch
    enabled: true
    locale: de_DE.UTF-8
    base: 'https://example.net/'
    baseVariants:
      - base: 'https://de.example.localhost/'
        condition: 'applicationContext == "Development"'
      - base: 'https://staging.example.net/'
        condition: 'applicationContext == "Production/Sydney"'
      - base: 'https://testing.example.net/'
        condition: 'applicationContext == "Testing/Paris"'
    websiteTitle: ''
    navigationTitle: Deutsch
    fallbackType: strict
    flag: de
    languageId: 1
Properties
- typo3.version
- 
        - type
- 
            
    string 
- Example
- 
            
    12.4. 0 
 The current TYPO3 version. 
- typo3.branch
- 
        - type
- 
            
    string 
- Example
- 
            
    12.4 
 The current TYPO3 branch. 
- typo3.devIpMask
- 
        - type
- 
            
    string 
- Example
- 
            
    203.0. 113.* 
 The configured devIpMask taken from $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']. 
- applicationContext
- 
        - type
- 
            
    string 
- Example
- 
            
    Development
 The current application context. 
Functions
All functions from EXT:core/Classes/ExpressionLanguage/FunctionsProvider/DefaultFunctionsProvider.php (GitHub) are available:
- ip
- 
        - type
- 
            
    string 
- Example
- 
            
    ip("203. 0. 113.*") 
 Match an IP address, value or regex, wildcards possible. Special value: devfor matchingIp dev.Ip Mask 
- compatVersion
- 
        - type
- 
            
    string 
- Example
- 
            
    compat,Version ("12. 4. 0") compatVersion ("11. 5") 
 Match a TYPO3 version. 
- like
- 
        - type
- 
            
    string 
- Example
- 
            
    like("foobarbaz", "*bar*") 
 A comparison function to compare two strings. The first parameter is the "haystack", the second the "needle". Wildcards are allowed. 
- getenv
- 
        - type
- 
            
    string 
- Example
- 
            
    getenv("TYPO3_ BASE_ URL") 
 A wrapper for PHPs getenv() function. It allows accessing environment variables. 
- date
- 
        - type
- 
            
    string 
- Example
- 
            
    checking the current month: date("j") == 7 
 Get the current date in given format. 
- feature
- 
        - type
- 
            
    string 
- Example
- 
            
    feature("redirects. hit Count") 
 Check whether a feature ("feature toggle") is enabled in TYPO3. 
- traverse
- 
        - type
- 
            
    array|string 
- Example
- 
            
    traverse(request. get Query Params (), 'tx_ news_ pi1/ news') > 0 
 This function has two parameters: - first parameter is the array to traverse
- second parameter is the path to traverse