Constants

What are constants?

Constants are values defined in the "Constants" field of a template. They follow the syntax of ordinary TypoScript and are case sensitive! They are used to manage in a single place values, which are later used in several places.

Note

Reserved name

The object or property "file" is always interpreted as data type "resource". That means it refers to a file, which you have to upload in your TYPO3 CMS installation.

Important

Multi-line values: The ( ) signs

Constants do not support multiline values!

Example

Here bgCol is set to "red", file.toplogo is set to "fileadmin/logo.gif" and topimg.file.pic2 is set to "fileadmin/logo2.gif", assuming these files are indeed available at the expected location.

bgCol = red
topimg.width = 200
topimg.file.pic2 = fileadmin/logo2.gif
file.toplogo = fileadmin/logo.gif

This could also be defined in other ways, e.g. like this:

bgCol = red
file {
  toplogo = fileadmin/logo.gif
}
topimg {
  width = 200
  file.pic2 = fileadmin/logo2.gif
}

(The objects in the highlighted lines contain the reserved word "file" and the properties are always of data type "resource".)

Overview of the defined constants

The module constant which is visible in the above screenshot comes from the TYPO3 CMS core itself.