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.
boolean¶
- boolean¶
Possible values for boolean variables are
1
and0
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¶
- case¶
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
toUpperCamelCase
lowercamelcase
Convert underscored
lower_camel_case
tolowerCamelCase
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¶
- date-conf¶
Used to format a date, see PHP function
date()
. See the documentation of allowed date time formats in PHP.Example
EXT:site_package/Configuration/TypoScript/setup.typoscript¶page.10.date-conf = d-m-y
dir¶
- 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]
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 (withfileadmin/files/
prepended):EXT:site_package/Configuration/TypoScript/setup.typoscript¶page.10.dir = fileadmin/files/ | pdf,gif,jpg | name | r | true
function name¶
- function name¶
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 withux_
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¶
- 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.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)
imageExtension¶
- imageExtension¶
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 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¶
- imgResource¶
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.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... }
resource¶
- resource¶
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
strftime-conf¶
- strftime-conf¶
See function strftime on php.net.
string¶
- string¶
Sometimes used generally though another type would have been more appropriate, like "align".
Example
The quick brown fox jumps over the lazy dog.
target¶
- target¶
Examples
_top
,_blank
,content
Target in an
<a>
-tag.This is normally the same value as the name of the root-level object that defines the frame.
wrap¶
- wrap¶
- Syntax
<...> | </...>
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 ofwrap
.A
wrap
is processed and rendered as the last of the other components of a cObject.Examples
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>