3.4.2 TypoScript Variables

TypoScript is the common configuration language used within the TYPO3 core itself. It comes with a few conventions to be used by every extension author.

As using FluidTYPO3 for templating means you are essentially creating a new extension which relies on the extbase conventions, you have to stick to the pattern and can directly benefit from it.


I want to assign a variable in TypoScript and use it in my template.


In traditional TYPO3 projects, you would have accessed a value through TypoScript constants and would have used this in a wrap. With FluidTYPO3 templating, we've got you covered by using the extbase conventions for TypoScript cascading values. The list below shows how a value is processed:

  1. You set a TypoScript constant plugin.tx_myproject.settings.baseclass = green in Configuration/TypoScript/constants.txt. Doing this upfront gives you the power of the constants editor in the template module and allows for easy changing of the value.
  2. You import this constant into TypoScript setup: plugin.tx_myproject.settings.baseclass = {$plugin.tx_myproject.settings.baseclass} in Configuration/TypoScript/setup.txt
  3. You could override the value at any level in the page tree via constants editor
  4. You could override the value in any flexform you create by simply naming the field settings.baseclass
  5. The value is available in your PageController actions for further reading (changes in the controller won't propagate to the view) $this->settings
  6. The value finally pops into your template and can be accessed via {settings.baseclass}


TypoScript constants

plugin.tx_myproject.settings.baseclass = green

TypoScript setup

plugin.tx_myproject.settings.baseclass = {$plugin.tx_myproject.settings.baseclass}

fluidcontent / fluidpages / generally flux form

<flux:field.input name="settings.baseclass"/>

Controller Context (PageController, ContentController, AbstractFluxController)

function footemplateAction(){
   // available here for *reading*

Template rendering

<div class="{settings.baseclass}">
    <img src="coolcatpictures.com/image.png />

Easy huh?

Tips & Tricks

The {settings} variable is available in every subview of the rendered template. That means you don't have to pass something like arguments="{settings: settings}" to your partial rendering.

Jump to...