Change Typoscript values at parsetime
Typoscript properties in the CONFIG section are usually defined once and at a certain point. But what if you have defined the value of a property at some place and like to add another one later in the parsing process?
Example
A prominent example is config.linkVars. In most cases, it's used to append the global language parameter L to typolinks:
config.linkVars = L
However, if you need to append another value to that property using a basis template or an extension template, you can do this with := addToList():
config.linkVars := addToList(print)
Parsing both properties will have the same result as:
config.linkVars = L, print
List of functions
It's so easy, isn't it? Mind the := operator as a placeholder for the parser to process the function. The "TypoScript Syntax and In-depth Study" docs reveal the following list of functions which can be used here. There's even a hook to use your own functions.
prependString()
... adds a string before the existing one.
appendString()
... adds a string after the existing one.
removeString()
... removes a string from the existing one. str_replace() is used here.
replaceString()
... replaces an existing string with a new one. str_replace() is used here,with the pipe symbol | as a divider.
addToList()
... appends values to a comma separated list. The list will neither be sorted nor distinct. Multiple values are given as a comma separated list.
removeFromList()
... removes values from a comma separated list. Multiple values are given as a comma separated list.
Comments
Leave a comment:
About this site
At the moment, T3node is a TYPO3 blog by Steffen Müller. Beside TYPO3, technical and nontechnical topics about free software and the internet are discussed.
This blog is also a personal survey about what motivates me to write this blog and what issues are worth writing. Statistically, my motivation to do this is probably to
1. express myself
2. connect with other people
3. share knowledge with other people
All contents are distributed under the Creative Commons Attribution - NonCommercial - ShareAlike 3.0 Unported licence.
Article tags
