Simple data types

The values assigned to properties in TypoScript are often of a specific format. These formats are described in this chapter.

For example, if a value is defined as the type <tag>, HTML code has to be supplied. If it is of the type resource, it's a reference to a file from the resource-field in the template. If the type is GraphicColor, a color-definition is expected and an HTML color code or comma-separated RGB-values have to be provided.

The following is a list of available data types, their usage, purpose and examples.

align

Data type:

align

Description:

Decides about alignment.

Examples:

left, center, right

Default:

left

boolean

Data type:

boolean

Description:

Possible values for boolean variables are 1 and 0 meaning TRUE and FALSE.

Everything else is evaluated to one of these values by PHP: Non-empty strings (except 0 [zero]) are treated as TRUE, empty strings are evaluated to FALSE.

Examples:

EXT:site_package/Configuration/TypoScript/setup.typoscript
dummy.enable = 0   # false, preferred notation
dummy.enable = 1   # true,  preferred notation
dummy.enable =     # false, because the value is empty

case

Data type:

case

Description:

Do a case conversion.

Possible values:

Value

Effect

upper

Convert all letters of the string to upper case

lower

Convert all letters of the string to lower case

capitalize

Uppercase the first character of each word in the string

ucfirst

Convert the first letter of the string to upper case

lcfirst

Convert the first letter of the string to lower case

uppercamelcase

Convert underscored upper_camel_case to UpperCamelCase

lowercamelcase

Convert underscored lower_camel_case to lowerCamelCase

Example:

Code:

EXT:site_package/Configuration/TypoScript/setup.typoscript
10 = TEXT
10.value = Hello world!
10.case = upper

Result:

Example Output
HELLO WORLD!

date-conf

Data type:

date-conf

Description:

Used to format a date, see PHP function date(). The following abbreviations are available:

Abb

The abbreviation is expanded to:

a

"am" or "pm"

A

"AM" or "PM"

d

01 - 31, day of the month, numeric, 2 digits with leading zeros

D

day of the week, textual, 3 letters like "Fri"

F

month, textual, long, like "January"

h

hour, numeric, 12 hour format

H

hour, numeric, 24 hour format

i

minutes, numeric

j

1 - 31, day of the month, numeric, without leading zeros

l

(lowercase 'L'), day of the week, textual, long, like "Friday"

m

month, numeric

M

month, textual, 3 letters, like "Jan"

s

seconds, numeric

S

English ordinal suffix, textual, 2 characters, like "th" or "nd"

U

seconds since the epoch

Y

year, numeric, 4 digits, like "2013"

w

day of the week, numeric, 0 represents Sunday

y

year, numeric, 2 digits, like "13"

z

day of the year, numeric, like "299"

Example:

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.date-conf = d-m-y

degree

Data type:

degree

Description:

-90 to 90, integers

Example:

45

dir

Data type:

dir

Syntax:

[path relative to the web root of the site] | [list of valid extensions] | [sorting: name, size, ext, date] | [reverse: "r"] | [return full path: boolean]

Description:

Files matching are returned in a comma-separated string.

Example:

This example returns a list of all pdf, gif and jpg-files from fileadmin/files/ sorted by their name reversely and with the full path (with fileadmin/files/ prepended):

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.dir = fileadmin/files/ | pdf,gif,jpg | name | r | true

function name

Data type:

function name

Description:

Indicates a function or method in a class to call. See more information at the USER cObject.

If no namespaces are used, then the class or function name, but not the method name, should probably be prefixed with user_. The prefix can be changed in the $GLOBALS['TYPO3_CONF_VARS'] config though. The function / method is normally called with 2 parameters, $conf which is the TypoScript configuration and $content, some content to be processed and returned.

If no namespaces are used and if a method in a class is called, it is checked (when using the USER/USER_INT objects) whether a class with the same name, but prefixed with ux_ is present and if so, this class is instantiated instead. See the document "Inside TYPO3" for more information on extending classes in TYPO3!

Examples:

Method in namespaced class. This is the preferred version:

Your\NameSpace\YourClass->reverseString

Single Function:

user_reverseString

Method in class without namespace:

user_yourClass->reverseString

getText

The getText data type is some kind of tool box allowing to retrieve values from a variety of sources. Read more: Data / getText

GraphicColor

Data type:

GraphicColor

Syntax:

[colordef] : [modifier]

Where modifier can be an integer which is added or subtracted to the three RGB-channels or a floating point with an * before, which will then multiply the values with that factor.

Description:

The color can be given as HTML-color or as a comma-separated list of RGB-values (integers). An extra parameter can be given, that will modify the color mathematically:

Examples:

red (HTML-color)

#ffeecc (HTML-color)

255,0,255 (RGB-integers)

Extra:

red : *0.8 ("red" is darkened by factor 0.8)

#ffeecc : +16 ("ffeecc" is going to #fffedc because 16 is added)

HTML code

Data type:

HTML code

Description:

Pure HTML code

Example:

Example HTML code
<b>Some text in bold</b>

HTML-color

Data type:

HTML-color

Description:

Named colors or color codes.

Some HTML color codes are:

Color name

Hexadecimal code

Black

#000000

Silver

#C0C0C0

Gray

#808080

White

#FFFFFF

Maroon

#800000

Red

#FF0000

Purple

#800080

Fuchsia

#FF00FF

Green

#008000

Lime

#00FF00

Olive

#808000

Yellow

#FFFF00

Navy

#000080

Blue

#0000FF

Teal

#008080

Aqua

#00FFFF

Examples:

red

#ffeecc

imageExtension

Data type:

imageExtension

Description:

Image extensions can be anything among the allowed types defined in the global variable $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']. Standard is pdf, gif, jpg, jpeg, tif, bmp, ai, pcx, tga, png.

The value "web" is special. This will just ensure that an image is converted to a web image format (gif or jpg) if it happens not to be already!

Examples:

jpg

web (gif or jpg ..)

imgResource

Data type:

imgResource

Description:
  1. A resource plus imgResource properties.

    Filetypes can be anything among the allowed types defined in the configuration variable $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']. Standard is pdf, gif, jpg, jpeg, tif, bmp, ai, pcx, tga, png.

  2. A GIFBUILDER object. See the object reference for GIFBUILDER below.

Examples:

Here "file" is an imgResource:

EXT:site_package/Configuration/TypoScript/setup.typoscript
10 = IMAGE
10 {
    file = fileadmin/toplogo.gif
    file.width = 200
}

GIFBUILDER:

EXT:site_package/Configuration/TypoScript/setup.typoscript
10 = IMAGE
10.file = GIFBUILDER
10.file {
    # GIFBUILDER properties here...
}

integer

Data type:

integer / int

Examples:

42, -8, -9, 0

Description:

This data type is sometimes used generally though another type would have been more appropriate, like pixels.

linkWrap

Data type:

linkWrap

Syntax:

<.. {x}.> | </...>

Description:

{x}; x is an integer (0-9) and points to a key in the PHP array root line. The key is equal to the level the current page is on measured relatively to the root of the website.

If the key exists the uid of the level that key pointed to is inserted instead of {x}.

Thus we can insert page_ids from previous levels.

Example:

This will make a link to the root-level of a website:

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.linkWrap = <a href="?id={0}"> | </a>

list

Data type:

list

Description:

List of values, comma separated. Values are trimmed, leading whitespace is therefore ignored before and after each comma.

Example:

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.myList = item,item2,item3

margins

Data type:

margins

Syntax:

left, top, right, bottom

Example:

This sets margin-left to 10 and margin-bottom to 5. Top and right are not set (zero):

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.myMargins = 10,0,0,5

page_id

Data type:

page_id

Description:

A page id (integer) or this (=current page id).

Examples:
EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.settings.pid = this

page.20.settings.pid = 34

path

Data type:

path

Description:

Path relative to the root directory from which we operate.

Example:
EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.settings.somePath = fileadmin/stuff/

pixels

Data type:

pixels

Description:

pixel-distance

Example:
EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.someWidth = 345

positive integer

Data type:

positive integer / posint / int+

Description:

Positive integer.

Examples:

42, 8, 9

resource

Data type:

resource

Description:

If the value contains a "/", it is expected to be a reference (absolute or relative) to a file in the file system. There is no support for wildcard characters in the name of the reference.

Example:

Reference to a file in the file system:

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.settings.someFile = fileadmin/picture.gif

rotation

Data type:

rotation

Description:

integer, degrees from 0 - 360

Example:

180

space

Data type:

space

Syntax:

"space before | space after"

Description:

Used for content and sets the according number of pixels space "before | after".

Example:
EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.someSpace = 5 | 5

strftime-conf

Data type:

strftime-conf

Description:

Abb

The abbreviation is expanded to:

%a

abbreviated weekday name according to the current locale

%A

full weekday name according to the current locale

%b

abbreviated month name according to the current locale

%B

full month name according to the current locale

%c

preferred date and time representation for the current locale

%C

century number (the year divided by 100 and truncated to an integer, range 00 to 99)

%d

day of the month as a decimal number (range 00 to 31)

%D

same as %m/%d/%y

%e

day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31'). Note that the %e modifier is not supported in the Windows implementation of 'strftime'.

%h

same as %b

%H

hour as a decimal number using a 24-hour clock (range 00 to 23)

%I

hour as a decimal number using a 12-hour clock (range 01 to 12)

%j

day of the year as a decimal number (range 001 to 366)

%m

month as a decimal number (range 01 to 12)

%M

minute as a decimal number

%n

newline character

%p

either `am' or `pm' according to the given time value, or the corresponding strings for the current locale

%r

time in a.m. and p.m. notation

%R

time in 24 hour notation

%S

second as a decimal number

%t

tab character

%T

current time, equal to %H:%M:%S

%u

weekday as a decimal number [1,7], with 1 representing Monday

%U

week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week

%V

The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week.

%W

week number of the current year as a decimal number, starting with the first Monday as the first day of the first week

%w

day of the week as a decimal, Sunday being 0

%x

preferred date representation for the current locale without the time

%X

preferred time representation for the current locale without the date

%y

year as a decimal number without a century (range 00 to 99)

%Y

year as a decimal number including the century

%Z

time zone or name or abbreviation

%%

a literal `%' character

Examples:

Date "DD-MM-YY" = :

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.settings.myDate = %e:%m:%y

Time "HH:MM:SS" = :

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.settings.myTime = %H:%M:%S

or just :

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.settings.someTime = %T

string

Data type:

string / str / value

Description:

Sometimes used generally though another type would have been more appropriate, like "align".

Example:

The quick brown fox jumps over the lazy dog.

<tag>

Data type:

<tag>

Description:

An HTML tag.

Example:
EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.settings.bodyTag = <body lang="de">

<tag>-data

Data type:

<tag>-data

Examples:

<frameset>-data: row

could be '150,*'

<tag>-params

Data type:

<tag>-params

Description:

Parameters for a tag.

Example:

For <frameset>-params:

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.settings.someParams = border="0" framespacing="0"

target

Data type:

target

Examples:

_top, _blank, content

Description:

Target in an <a>-tag.

This is normally the same value as the name of the root-level object that defines the frame.

UNIX-time

Data type:

UNIX-time

Description:

Seconds since January 1st 1970.

Example:

Seconds to May 09th 2016 12:34:

1462790096

VHalign

Data type:

VHalign

Description:

Pair of values separated by a comma. The first value determines the horizontal alignment, the second one the vertical alignment.

Possible values:

  • r/c/l

  • t/c/b

Horizontal values standing for: right, center, left

Vertical values standing for: top, center, bottom

Default: l , t

Example:

Horizontal alignment = right and Vertical alignment = center:

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.settings.someAlignment = r , c

wrap

Data type:

wrap

Syntax:

<...> | </...>

Description:

Used to wrap something. The vertical bar ("|") is the place, where your content will be inserted; the parts on the left and right of the vertical line are placed on the left and right side of the content.

Spaces between the wrap-parts and the divider ("|") are trimmed off from each part of the wrap.

If you want to use more sophisticated data functions, then you should use stdWrap.dataWrap instead of wrap.

A wrap is processed and rendered as the last of the other components of a cObject.

Example:

This will cause the value to be wrapped in a p-tag coloring the value red:

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.stdWrap.wrap = <p class="bg-red"> | </p>

x,y,w,h

Data type:

x,y,w,h

Description:

x,y is the offset from the upper left corner.

w,h is the width and height

Example:

EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10.someDimensions = 10,10,5,5