Professional Documents
Culture Documents
TYPO3 v4.3 Doc Core TSref
TYPO3 v4.3 Doc Core TSref
TypoScript Reference
1
TypoScript Reference - doc_core_tsref TypoScript Reference
Table of Contents
TypoScript Reference..................................1 Content Objects (cObject)...................................77
Introduction...........................................................4 HTML...................................................................79
Warning.................................................................4 TEXT....................................................................79
General information................................................4 COBJ_ARRAY (COA, COA_INT)..............................79
Data types..............................................................5 FILE.....................................................................80
Introduction...........................................................5 IMAGE..................................................................81
Data types reference...............................................5 IMG_RESOURCE...................................................81
Objects and properties.........................................12 CLEARGIF.............................................................81
Introduction..........................................................12 CONTENT.............................................................82
Conditions............................................................16 RECORDS.............................................................83
Condition reference...............................................16 HMENU.................................................................84
Functions..............................................................26 CTABLE................................................................93
stdWrap...............................................................26 OTABLE................................................................93
imgResource.........................................................33 COLUMNS.............................................................94
imageLinkWrap.....................................................34 HRULER................................................................94
numRows.............................................................35 IMGTEXT..............................................................95
select...................................................................35 CASE....................................................................99
split......................................................................36 LOAD_REGISTER:.................................................99
if..........................................................................37 RESTORE_REGISTER...........................................100
typolink................................................................38 FORM.................................................................100
textStyle...............................................................41 SEARCHRESULT..................................................105
encapsLines..........................................................42 USER and USER_INT...........................................108
tableStyle.............................................................44 PHP_SCRIPT.......................................................109
addParams............................................................45 PHP_SCRIPT_INT................................................109
filelink..................................................................45 PHP_SCRIPT_EXT................................................110
parseFunc.............................................................46 TEMPLATE..........................................................111
makelinks.............................................................49 MULTIMEDIA......................................................113
tags......................................................................50 EDITPANEL.........................................................114
HTMLparser..........................................................51 GIFBUILDER.......................................................115
HTMLparser_tags..................................................52 GIFBUILDER.......................................................115
Setup....................................................................53 Object names in this section.................................117
Top-level objects...................................................53 NON-GifBuilderObj...............................................124
The “plugin” TLO...................................................54 MENU Objects....................................................125
"CONFIG".............................................................54 Common properties.............................................125
"CONSTANTS".......................................................69 Common item states for TMENU, GMENU and
"PAGE".................................................................69 IMGMENU series:................................................128
"FE_DATA"...........................................................74 [menuObj].sectionIndex......................................128
"FE_TABLE"..........................................................74 GMENU...............................................................129
"FRAME"...............................................................75 GMENU_FOLDOUT..............................................135
"META".................................................................76 TMENU...............................................................137
"CARRAY".............................................................76 TMENUITEM.......................................................137
2
TypoScript Reference - doc_core_tsref TypoScript Reference
3
TypoScript Reference - doc_core_tsref Introduction
Introduction
Warning
This document is a reference - it does not intend to guide you step by step into TYPO3 or TypoScript. So you should know
what you are looking for when coming to this document and then let tutorials do the explanatory work for you.
For more information about TypoScript itself, please refer to “TypoScript Syntax and In-depth Study”.
General information
Case sensitivity
All names and references in TypoScript are case sensitive! This is very important to notice. That means that:
myObject = HTML
myObject.Value = <BLINK> HTML - code </BLINK>
The latter case will not be recognized as the content-object "HTML". In this manual the case of objects is therefore
important
4
TypoScript Reference - doc_core_tsref Data types
Data types
Introduction
The values you assign to properties in TypoScript are often of a specific format. The following table describes these formats.
E.g. if a value is defined as the type "<tag>", you're supposed to supply HTML-code. 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 you
should supply a HTML-valid color-code or RGB-values comma-separated.
5
TypoScript Reference - doc_core_tsref Data types
6
TypoScript Reference - doc_core_tsref Data types
a - "am" or "pm"
A - "AM" or "PM"
d - day of the month, numeric, 2 digits (with leading
zeros)
D - day of the week, textual, 3 letters; i.e. "Fri"
F - month, textual, long; i.e. "January"
h - hour, numeric, 12 hour format
H - hour, numeric, 24 hour format
i - minutes, numeric
j - day of the month, numeric, without leading zeros
l (lowercase 'L') - day of the week, textual, long; i.e.
"Friday"
m - month, numeric
M - month, textual, 3 letters; i.e. "Jan"
s - seconds, numeric
S - English ordinal suffix, textual, 2 characters; i.e.
"th", "nd"
U - seconds since the epoch
Y - year, numeric, 4 digits
w - day of the week, numeric, 0 represents Sunday
y - year, numeric, 2 digits
z - day of the year, numeric; i.e. "299"
7
TypoScript Reference - doc_core_tsref Data types
8
TypoScript Reference - doc_core_tsref Data types
9
TypoScript Reference - doc_core_tsref Data types
-----------------------------------------------------------------
Getting array/object elements
You can fetch the value of an array/object by splitting
it with a pipe “|”.
Example:
= TSFE:fe_user|user|username
10
TypoScript Reference - doc_core_tsref Data types
.sectionIndex
.alternativeSortingFields
(see the menu-object pages later)
GifBuilderObj TEXT / SHADOW / OUTLINE / EMBOSS /
BOX / IMAGE / EFFECT
11
TypoScript Reference - doc_core_tsref Objects and properties
Example:
45 + 34 * 2 = 158 (which is the same as this is ordinary arithmetic: (45+34)*2=158 )
"... /stdWrap"
When a datatype is set to "type /stdWrap" it means that the value is parsed through the stdWrap function with the properties
of the value as parameters.
Example:
pixels /stdWrap: Here the value should be set to pixels and parsed through stdWrap.
In a real application we could do like this:
.pixels.field = imagewidth
.pixels.intval = 1
This example imports the value from the field "imagewidht" of the current $cObj->data-array. But we don't trust the result to
be an integer so we parse it through the the intval()-function.
optionSplit
optionSplit is a very tricky function. It's primarily used in the menu-objects where you define properties of a whole bunch of
items at once. Here the value of properties would be parsed through this function an depending on your setup you could eg.
let the last menu-item appear with another color than the other.
The syntax is like this:
|*| - splits the value in parts first, middle, last.
|| - splits each of the first, middle, last in subparts
1. The priority is last, first, middle.
2. If the middle-value is empty (""), the last part of the first-value is repeated.
3. If the first- or middle value is empty, the first part of the last-value is repeated before the last value
4. The middle value is rotated.
ex: first1 || first2 |*| middle1 || middle2 || middle3 |*| last1 || last 2
Examples:
This is very complex and you might think that this has gone too far. But it's actually usefull.
Now consider a menu with five items:
Introduction
Who are we?
Business
Contact
Links
12
TypoScript Reference - doc_core_tsref Objects and properties
... and a configuration like this (taken from the example-code on the first pages):
temp.topmenu.1.NO {
backColor = red
....
}
If you look in this reference (see later) at the linkWrap-property of the GMENU-object, you'll discover that all properties of .NO
is parse through optionSplit. This means that before the individual menuitems are generated, the properties are split by this
function. Now lets look at some examples:
Subparts ||
Example:
All items take on the same value. Only the first-part is defined and thus it's repeated to all elements
TS: backColor = red
Introduction (red)
Who are we? (red)
Business (red)
Contact (red)
Links (red)
Example:
Here the first-part is split into subparts. The third subpart is repeated because the menu has five items.
TS: backColor = red || yellow || green
Parts |*|
Example:
Now a middle-value is also defined ("white"). This means that after the first two menu-items the middle-value is used.
TS: backColor = red || yellow |*| white
Example:
Now a last-value is also defined ("blue || olive"). This means that after the first two menu-items the middle-value is used.
TS: backColor = red || yellow |*| white |*| blue || olive
13
TypoScript Reference - doc_core_tsref Objects and properties
... and if we contract the menu to only four items (the middle-value is discarted as it's priority is the least)
Introduction (red) first, subpart 1
Who are we? (yellow) first, subpart 2
Contact (blue) last, subpart 1
Links (olive) last, subpart 2
... and if we contract the menu to only 3 items (the last subpart of the first-value is discarted as it's priority is less than the
last-value)
Introduction (red) first, subpart 1
Contact (blue) last, subpart 1
Links (olive) last, subpart 2
"2: If the middle-value is empty, the last part of the first-value is repeated"
Example:
The middle-value is left out now. Then subpart 2 of the first value is repeated. Please observe that no space must exist
between the two |*||*|!
TS: backColor = red || yellow |*||*| blue || olive
"3: If the first- or middle value is empty, the first part of the last-value is repeated before the last value"
Example:
The middle-value and first-value is left out now. Then the subpart 1 of the last value is repeated. Please observe that no
space must exist between the two |*||*|!
TS: backColor = |*||*| blue || olive
14
TypoScript Reference - doc_core_tsref Objects and properties
Example:
TS: backColor = red |*| yellow || green |*|
15
TypoScript Reference - doc_core_tsref Conditions
Conditions
Condition reference
General notes
Values are normally trimmed for whitespaces before comparison.
You may combine several conditions with two operators: && (and), || (or)
Alternatively you may use "AND" and "OR" instead of "&&" and "||". The AND operator has always higher precedence over
OR. If no operator has been specified, it will default to OR.
For full explanations about conditions, please refer to “TypoScript Syntax and In-depth Study”.
Examples:
This condition will match if the visitor opens the website with Internet Explorer on Windows (but not on Mac)
[browser = msie] && [system = win]
This will match with either Internet Explorer or Netscape. In case of Netscape, the version must be above 4.
[browser = msie] || [browser = netscape] && [version => 4]
browser
Syntax:
[browser = browser1,browser2,...]
Browser: Identification:
Microsoft Internet Explorer msie
Netscape Communicator netscape
Lynx lynx
Opera opera
PHP fopen php
AvantGo (www.avantgo.com) avantgo
Adobe Acrobat WebCapture acrobat
IBrowse (amiga-browser) ibrowse
Teleport Pro teleport
?? (if "mozilla" is not in useragent) unknown
Examples:
This will match with netscape and opera-browsers
[browser = netscape, opera]
16
TypoScript Reference - doc_core_tsref Conditions
version
Syntax:
[version = value1, >value2, =value3, <value4, ...]
Comparison:
values are floating-point numbers with "." as the decimal separator.
The values may be preceeded by three operators:
Operator: Function:
[nothing] The value must be part of the beginning of the version as a string. This means that if the
version is "4.72" and the value is "4" or "4.7" it matches. But "4.73" does not match.
Example from syntax: "value1"
= The value must match exactly. Version "4.72" matches only with a value of "4.72"
> The version must be greather than the value
< The version must be less than the value
Examples:
This matches with exactly "4.03" browsers
[version= =4.03]
system
Syntax:
[system= system1,system2]
System: Identification:
Linux linux
SGI / IRIX unix_sgi
SunOS unix_sun
HP-UX unix_hp
Macintosh mac
Windows 3.11 win311
Windows NT winNT
Windows 95 win95
Windows 98 win98
Amiga amiga
Values are strings an a match happens if one of these strings is the first part of the system-identification.
Fx. if the value is "win9" this will match with "win95" and "win98" systems.
Examples:
This will match with windows and mac -systems only
[system= win,mac]
17
TypoScript Reference - doc_core_tsref Conditions
device
Syntax:
[device= device1, device2]
Device: Identification:
HandHeld pda
WAP phones wap
Grabbers: grabber
Indexing robots: robot
Values are strings an a match happens if one of these strings equals the type of device
Examples:
This will match WAP-phones and PDA's
[device= wap, pda]
useragent
Syntax:
[useragent= agent]
Examples:
If the HTTP_USER_AGENT is "Mozilla/4.0 (compatible; Lotus-Notes/5.0; Windows-NT)" this will match with it:
[useragent = Mozilla/4.0 (compatible; Lotus-Notes/5.0; Windows-NT)]
... but this will also match with a useragent like this: "Lotus-Notes/4.5 ( Windows-NT )"
A short list of user-agent strings and a proper match:
18
TypoScript Reference - doc_core_tsref Conditions
WAP-agents:
This is some of the known WAP agents:
language
Syntax:
[language = lang1, lang2, ...]
Comparison:
The values must be a straight match with the value of getenv(“HTTP_ACCEPT_LANGUAGE”) from PHP. Alternatively, if the
value is wrapped in “*” (eg. “*en-us*”) then it will split all languages found in the HTTP_ACCEPT_LANGUAGE string and try to
match the value with any of those parts of the string. Such a string normally looks like “de,en-us;q=0.7,en;q=0.3” and “*en-
us*” would match with this string.
19
TypoScript Reference - doc_core_tsref Conditions
IP
Syntax:
[IP = ipaddress1, ipaddress2, ...]
Comparison:
The values are compared with the getenv(“REMOTE_ADDR”) from PHP.
You may include "*" instead of one of the parts in values. You may also list the first one, two or three parts and only they will
be tested.
Examples:
These examples will match any IP-address starting with "123":
[IP = 123.*.*.*]
or
[IP = 123]
This examples will match any IP-address ending with "123" or being "192.168.1.34":
[IP = *.*.*.123][IP = 192.168.1.34]
hostname
Syntax:
[hostname = hostname1, hostname2, ...]
Comparison:
The values are compared with the fully qualiteid hostname of getenv(“REMOTE_ADDR”) retrieved by PHP.
Value is comma-list of domain names to match with. *-wildcard allowed but cannot be part of a string, so it must match the
full host name (eg. myhost.*.com => correct, myhost.*domain.com => wrong)
hour
Syntax:
[hour = hour1, >hour2, <hour3, ...]
Comparison:
The values in floating point are compared with the current hour (24-hours-format) of the server.
Operator: Function:
[nothing] Requires exact match
> The hour must be greather than the value
< The hour must be less than the value
minute
See "Hour" above. Same syntax!
Syntax:
[minute = ...]
20
TypoScript Reference - doc_core_tsref Conditions
Comparison:
Minute of hour, 0-59
dayofweek
See "Hour" above. Same syntax!
Syntax:
[dayofweek = ...]
Comparison:
Day of week, starting with Sunday being 0 and Saturday being 6
dayofmonth
See "Hour" above. Same syntax!
Syntax:
[dayofmonth = ...]
Comparison:
Day of month, 1-31
month
See "Hour" above. Same syntax!
Syntax:
[month = ...]
Comparison:
Month, January being 1 and December being 12
dayofyear
See "Hour" above. Same syntax! For further information look at the date() function in the PHP manual, format string z.
Syntax:
[dayofyear = ...]
Comparison:
Day of year, 0-364 (or 365)
year
See "Hour" above. Same syntax! For further information look at the date() function in the PHP manual, format string Y.
Syntax:
[year = ...]
Comparison:
Year, as a 4-digit number
21
TypoScript Reference - doc_core_tsref Conditions
usergroup
Syntax:
[usergroup = group1-uid, group2-uid, ...]
Comparison:
The comparison can only return true if the grouplist is not empty (global var "gr_list").
The values must either exists in the grouplist OR the value must be a "*".
Example:
This matches all logins
[usergroup = *]
This matches logins from users members of groups with uid's 1 and/or 2:
[usergroup = 1,2]
loginUser
Syntax:
[loginUser = fe_users-uid, fe_users-uid, ...]
Comparison:
Matches on the uid of a logged in fe_user. Works like 'usergroup' above including the * wildcard to select ANY user.
Example:
This matches any login (use this instead of “[usergroup = *]” to match when a user is logged in!):
[loginUser = *]
treeLevel
Syntax:
[treeLevel = levelnumber, levelnumber, ...]
Comparison:
This checks if the last element of the rootLine is at a level corresponding to one of the figures in "treeLevel". Level = 0 is the
"root" of a website. Level=1 is the first menuen
Example:
This changes something with the template, if the page viewed is on level either level 0 (basic) or on level 2
[treeLevel = 0,2]
PIDinRootline
Syntax:
[PIDinRootline = pages-uid, pages-uid, ...]
22
TypoScript Reference - doc_core_tsref Conditions
Comparison:
This checks if one of the figures in "treeLevel" is a PID (pages-uid) in the rootline
Example:
This changes something with the template, if the page viewed is or is a subpage to page 34 or page 36
[PIDinRootline = 34,36]
PIDupinRootline
Syntax:
[PIDupinRootline = pages-uid, pages-uid, ...]
Comparison:
Do the same as PIDinRootline, except the current page-uid is excluded from check.
compatVersion
Syntax:
[compatVersion = x.y.z]
Comparison:
Require a minimum compatibility version. This version is not necessary equal with the TYPO3 version, it is a configurable value
that can be changed in the Upgrade Wizard of the Install Tool.
“compatVersion” is especially useful if you want to provide new default settings but keep the backwards compatibility for old
versions of TYPO3.
globalVar
Syntax:
[globalVar = var = value1, > value2, < value3, <= value4 , >= value5, != value6, ...]
Comparison:
The values in floating point are compared with the global variable "var" from above.
Operator: Function:
= Requires exact match
> The var must be greater than the value
< The var must be less than the value
<= The var must be less or equal than the value
>= The var mast be greater or equal than the value
!= The var must be not equal to the value
Examples:
This will match with a url like “...&print=1”
[globalVar = GP:print > 0]
23
TypoScript Reference - doc_core_tsref Conditions
[globalVar = GP:style = ]
This will match with the pages having the layout field set to “Layout 1”:
[globalVar = TSFE:page|layout = 1]
globalString
Syntax:
[globalString = var1=value, var2= *value2, var3= *value3*, ...]
Comparison:
This is a direct match on global strings.
You have the options of putting a "*" as a wildcard or using a PCRE style regular expression (must be wrapped in "/") to the
value.
Examples:
If the HTTP_HOST is "www.typo3.com" this will match with:
[globalString = IENV:HTTP_HOST = www.typo3.com]
... but this will also match with a HTTP_HOST like this: "demo.typo3.com"
Examples:
The global var $HTTP_POST_VARS["key"]["levels"] would be retrieved by "HTTP_POST_VARS|key|levels"
Also note that it's recommended to program your scripts in compliance with the php.ini-optimized settings. Please see that file
(from your distribution) for details.
Caring about this means that you would get values like HTTP_HOST by getenv() and you would retrieve GET/POST values
with t3lib_div::_GP(). Finally a lot of values from the TSFE object are useful. In order to get those values for comparison with
“globalVar” and “globalString” conditions, you prefix that variable's name with either "IENV:"/“ENV:” , “GP:”, “TSFE:” or
“LIT:” respectively. Still the “|” divider may be used to separate keys in arrays and/or objects. “LIT” means “literal” and the
string after “:” is trimmed and returned as the value (without being divided by “|” or anything)
Notice: Using the "IENV:" prefix is highly recommended to get server/environment variables which are system-independent.
Basically this will get the value using t3lib_div::getIndpEnv(). With "ENV:" you get the raw output from getenv() which is NOT
always the same on all systems!
Examples:
This will match with a remote-addr beginning with “192.168.”
[globalString = IENV:REMOTE_ADDR = 192.168.*]
userFunc
Syntax:
[userFunc = user_match(checkLocalIP)]
24
TypoScript Reference - doc_core_tsref Conditions
Comparison:
This call the function “user_match” with the first parameter “checkLocalIP”. You write that function. You decide what it
checks. Function result is evaluated as true/false.
Example:
Put this function in your localconf.php file:
function user_match($cmd) {
switch($cmd) {
case "checkLocalIP":
if (strstr(getenv("REMOTE_ADDR"),"192.168")) {
return true;
}
break;
case "checkSomethingElse":
// ....
break;
}
}
This condition will return true if the remote address contains “192.168” - which is what your function finds out.
[userFunc = user_match(checkLocalIP)]
25
TypoScript Reference - doc_core_tsref Functions
Functions
stdWrap
This function is often added as properties to values in TypoScript.
Example with the content-object, "HTML":
10 = HTML
10.value = some text
10.value.case = upper
Here the content of the object "10" is uppercased before it's returned.
stdWrap properties are executed in the order they appear in the table below. If you want to study this further please refer to
typo3/sysext/cms/tslib/class.tslib_content.php, function stdWrap().
Now the line "10.value = some text" is obsolete, because the whole value is "imported" from the field called "header" from the
$cObj->data-array.
Example:
config.language = de
page.10 = TEXT
page.10.value = I am a Berliner!
page.10.lang.de = Ich bin ein Berliner!
Note: You can also divide fieldnames by “//”. Say, you set “nav_title //
title” as the value, then the content from the field nav_title will be returned
unless it is a blank string, in which case the title-field's value is returned.
current boolean Sets the content to the "current"-value (see ->split)
cObject cObject Loads content from a content-object
numRows ->numRows Returns the number of rows resulting from the select
26
TypoScript Reference - doc_core_tsref Functions
Override / Conditions:
override string /stdWrap if "override" returns something else than "" or zero (trimmed), the content
is loaded with this!
preIfEmptyListNum (as "listNum" (as "listNum" below)
below)
ifEmpty string /stdWrap if the content is empty (trimmed) at this point, the content is loaded with
"ifEmpty". Zeros are treated as empty values!
ifBlank string /stdWrap Same as "ifEmpty" but the check is done using strlen().
listNum int Explodes the content with "," (comma) and the content is set to the
+calc item[value].
+"last"
Special keyword: "last" is set to the last element of the array!
.splitChar (string):
Defines the string used to explode the value. If splitChar is an integer, the
character with that number is used (eg. "10" to split lines...).
Default: “," (comma)
.stdWrap (stdWrap properties):
stdWrap properties of the listNum...
Examples:
We have a value of "item 1, item 2, item 3, item 4":
This would return "item 3":
.listNum = last - 1
trim PHP-function trim(); Removes whitespace around value
stdWrap ->stdWrap Recursive call to stdWrap function
required boolean This flag requires the content to be set to some value after any content-
import and treatment that might have happend now (data, field, current,
listNum, trim). Zero's is NOT regarded as empty! Use "if" instead!
If the content i empty, "" is returned immediately.
if ->if If the if-object returns false, stdWrap returns "" immediately
fieldRequired fieldname value in this field MUST be set
Parse data:
csConv string Convert the charset of the string from the charset given as value to the
current rendering charset of the frontend (renderCharset).
parseFunc object path Processing instructions for the content.
reference / Notice: If you enter a string as value this will be taken as a reference to
->parseFunc an object path globally in the TypoScript object tree. This will be the basis
configuration for parseFunc merged with any properties you add here. It
works exactly like references does for content elements.
Example:
parseFunc = < lib.parseFunc_RTE
parseFunc.tags.myTag = TEXT
parseFunc.tags.myTag.value = This will be inserted when <myTag>
is found!
HTMLparser boolean / This object allows you to parse the HTML-content and make all kinds of
->HTMLparser advanced filterings on the content.
Value must be set and properties are those of ->HTMLparser.
(See adminguide for ->HTMLparser options)
27
TypoScript Reference - doc_core_tsref Functions
Examples:
100%7 = 2
-5*-4 = 20
+6^2 = 36
6 ^(1+1) = 36
-5*-4+6^2-100%7 = 54
-5 * (-4+6) ^ 2 - 100%7 = 98
-5 * ((-4+6) ^ 2) - 100%7 = -22
char int Content is set to the chr(value).
PHP: $content=chr(intval($conf["char"]);
intval boolean PHP function intval(); Returns an integer.
PHP: $content=intval($content);
date date-conf The content should be data-type "UNIX-time". Returns the content
formatted as a date.
$content=Date($conf["date"], $content);
Properties:
.charset : Can be set to the charset of the output string if you need to
convert it to renderCharset. Default is to take the intelligently guessed
charset from t3lib_cs.
age boolean or string If enabled with a "1" (number, integer) the content is seen as a date
(UNIX-time) and the difference from present time and the content-time is
returned as one of these four variations:
"xx min" or "xx hrs" or "xx days" or "xx yrs"
The limits between which layout is used are 60 minutes, 24 hours, 365
days,
NOTE:
If you set this property with a non-integer, it's used to format the four
units. This is the default value:
" min| hrs| days| yrs"
Set another string if you want to change the units. You may include the "-
signs. They are removed anyway.
case case Converts case
If you add a value for the property “labels” you can alter the default
suffixes. Labels for bytes, kilo, mega and giga are separated by vertical bar
(|) and possibly encapsulated in "". Eg: " | K| M| G" (which is the default
value)
Thus:
bytes.labels = “ | K| M| G”
28
TypoScript Reference - doc_core_tsref Functions
Examples:
20 | ... => max 20 characters. If more, the value will be truncated to
first 20 chars and prepended with "..."
-20 | ... => max 20 characters. If more, the value will be truncated to
last 20 chars and appended with "..."
20 | ... | 1 => max 20 characters. If more, the value will be truncated to
last 20 chars and appended with "...". If the division is in the middle of a
word, the remains of that word is removed.
Notice: Currently this works only with TCA fields of type “select” which
are not database relations.
spaceBefore int /stdWrap Pixels space before. Done with a clear-gif; <img ...><BR>
spaceAfter int /stdWrap Pixels space after. Done with a clear-gif; <img ...><BR>
29
TypoScript Reference - doc_core_tsref Functions
Additional property:
.useDiv = 1
If set, a clear gif is not used but rather a <div> tag with a style-attribute
setting the height. (Affects spaceBefore and spaceAfter as well).
wrap wrap /+.splitChar .splitChar defines an alternative splitting character (default is “|” - the
vertical line)
noTrimWrap "special" wrap This wraps the content with the values val1 and val2 in the example below
- including surrounding whitespace! - without trimming the values. Note
that this kind of wrap requires a "|" character to begin and end the wrap.
Example:
| val1 | val2 |
wrap2 wrap /+.splitChar same as .wrap (but watch the order in which they are executed)
dataWrap The content is parsed for sections of {...} and the content of {...} is of the
type getText and substituted with the result of getText.
Example:
This will produce a tag around the content with an attribute that contains
the number of the current page:
<div id="{tsfe : id}"> | </div>
prepend cObject cObject prepended to content (before)
append cObject cObject appended to content (after)
wrap3 wrap /+.splitChar same as .wrap (but watch the order in which they are executed)
outerWrap wrap /stdWrap Wraps the complete content
insertData boolean If set, then the content string is parsed like .dataWrap above.
Example:
Displays the page title:
10 = TEXT
10.value = This is the page title: {page:title}
10.insertData = 1
offsetWrap x,y This wraps the input in a table with columns to the left and top that offsets
the content by the values of x,y. Based on the cObject OTABLE.
.stdWrap
- stdWrap properties wrapping the offsetWrap'ed output
postUserFunc function-name Calling a PHP-function or method in a class, passing the current content to
the function as first parameter and any properties as second parameter.
Please see the description of the cObject USER for in-depth information.
Example:
You can paste this example directly into a new template record.
page = PAGE
page.typeNum=0
includeLibs.something =
media/scripts/example_callfunction.php
page.10 = TEXT
page.10 {
value = Hello World
postUserFunc = user_reverseString
postUserFunc.uppercase = 1
}
page.20 = TEXT
page.20 {
value = Hello World
postUserFunc = user_various->reverseString
postUserFunc.uppercase = 1
postUserFunc.typolink = 11
}
30
TypoScript Reference - doc_core_tsref Functions
Example:
prefixComment = 2 | CONTENT ELEMENT, uid:{field:uid}/{field:CType}
Will indent the comment with 1 tab (and the next line with 2+1 tabs)
(Added in TYPO3 >3.6.0RC1)
editIcons string If not empty, then insert an icon linking to the typo3/alt_doc.php with
some parameters to build and backend user edit form for certain fields.
The value of this property is a list of fields from a table to edit. It's
assumed that the current record of the cObj is the record to be edited.
Syntax: optional tablename : comma list of fieldnames[list of pallette-field
names separated by | ]
.beforeLastTag (1,0,-1): If set (1), the icon will be inserted before the
last HTML tag in the content. If -1 the icon will be prepended to the
content. If zero (0) the icon is appended in the end of the content.
Example:
This will insert an edit icon which links to a form where the header and
bodytext fields are displayed and made available for editing (provided the
user has access!).
editIcons = tt_content : header, bodytext
Or this line that puts the header_align and date field into a “palette” which
means they are displayed on a single line below the header field. This
saves some space.
editIcons = header[header_align|date], bodytext
31
TypoScript Reference - doc_core_tsref Functions
imgResource
imgResource is properties that is used with the data type imgResource.
Example:
This scales the image toplogo.gif to the width of 200 pixels
file = toplogo.gif
file.width = 200
If both the width and the heigth are set and at least one of the numbers is
appended by a "c", cropscaling will be enabled. This means that the
proportions will be preserved and the image will be scaled to fit around a
rectangle with width/height dimensions. Then, a centered portion from
inside of the image (size defined by width/height) will be cut out.
The "c" can have a percentage value (-100 ... +100) after it, which
defines how much the cropping will be moved off the center to the
border.
Notice that you can only use “m” or “c” at the same time!
Examples:
This crops 120x80px from the center of the scaled image:
.width = 120c
.height = 80c
Example:
This returns the first image in the field "image" from the data-array:
.import = uploads/pics/
.import.field = image
.import.listNum = 0
maxW pixels /stdWrap Max width
maxH pixels /stdWrap Max height
minW pixels /stdWrap Min width (overrules maxW/maxH)
minH pixels /stdWrap Min height (overrules maxW/maxH)
32
TypoScript Reference - doc_core_tsref Functions
Example:
10 = IMAGE
10.file = fileadmin/images/image1.jpg
10.file.stripProfile = 1
Masking:
(Black hides, white shows)
m.mask imgResource The mask by which the image is masked onto "m.bgImg". Both "m.mask"
and "m.bgImg" is scaled to fit the size of the imgResource image!
NOTE: Both "m.mask" and "m.bgImg" must be valid images.
m.bgImg imgResource NOTE: Both "m.mask" and "m.bgImg" must be valid images.
m.bottomImg imgResource An image masked by "m.bottomImg_mask" onto "m.bgImg" before the
imgResources is masked by "m.mask".
Both "m.bottomImg" and "m.bottomImg_mask" is scaled to fit the size
of the imgResource image!
This is most often used to create an underlay for the imgResource.
NOTE: Both "m.bottomImg" and "m.bottomImg_mask" must be valid
images.
m.bottomImg_mask imgResource (optional)
NOTE: Both "m.bottomImg" and "m.bottomImg_mask" must be valid
images.
[tsref:->imgResource]
imageLinkWrap
This object wraps the input (an image) with a link to the script "showpic.php" with parameters that define such things as
the size of the image, the background color of the new window and so on.
An md5-hash of the parameters is generated. The hash is also generated in "showpic.php" and the hashes MUST match in
order for the image to be shown. This is a safety feature in order to prevent users from changing the parameters in the url
themselves.
PHP-function: $cObj->imageLinkWrap()
33
TypoScript Reference - doc_core_tsref Functions
Example:
1.imageLinkWrap = 1
1.imageLinkWrap {
enable = 1
bodyTag = <BODY bgColor=black>
wrap = <A href="javascript:close();"> | </A>
width = 800m
height = 600
JSwindow = 1
JSwindow.newWindow = 1
JSwindow.expand = 17,20
}
numRows
This object return the number of rows
select
This object generates an SQL-select statement needed to select records from the database.
Some records are hidden or timed by start and end-times. This is automatically added to the SQL-select by looking in the
tables.php-array (enablefields)
Also, if the "pidInList" feature is used, any page in the pid-list that is not visible for the user of the website IS REMOVED from
the pidlist. Thereby no records from hidden, timed or access-protected pages are selected! Nor records from recyclers.
34
TypoScript Reference - doc_core_tsref Functions
split
This object is used to split the input by a character and then parse the result onto some functions.
For each iteration the split index starting with 0 (zero) is stored in the register key SPLIT_COUNT.
Example:
This is an example of TypoScript-code that imports the content of field "bodytext" from the $cObj->data-array (ln 2). The
content is split by the linebreak-character (ln 4). The items should all be treated with a stdWrap (ln 5) which imports the value
of the item (ln 6). This value is wrapped in a tablerow where the first column is a bullet-gif (ln 7). Finally the whole thing is
wrapped in the proper table-tags (ln 9)
1 20 = TEXT
2 20.field = bodytext
3 20.split {
4 token.char = 10
5 cObjNum = 1
6 1.current = 1
7 1.wrap = <TR><TD valign="top"><IMG src="dot.gif"></TD><TD valign="top"> | </TD></TR>
8 }
9 20.wrap = <TABLE border="0" cellpadding="0" cellspacing="3" width="368"> | </TABLE><BR>
35
TypoScript Reference - doc_core_tsref Functions
if
This function returns true if ALL of the present conditions are met (they are AND'ed). If a single condition is false, the value
returned is false.
The returned value may still be negated by the ".negate"-property.
Explanation
the "if"-function is a very odd way of returning true or false! Beware!
"if" is normally used to decide whether to render an object or return a value (see the cObjects and stdWrap)
Here is how it works:
The function returns true or false. Whether it returns true or false depends on the properties of this function. Say if you set
"isTrue = 1" then result is true. If you set "isTrue.field = header" the function returns true if the field "header" in $cObj->data
is set!
If you want to compare values, you must load a base-value in the ".value"-property. Example:
.value = 10
.isGreaterThan = 11
This would return true because the value of ".isGreaterThan" is greater than 10, which is the base-value.
More complex is this:
.value = 10
.isGreaterThan = 11
.isTrue.field = header
.negate = 1
There are two conditions - isGreaterThan and isTrue. If they are both true, the total is true (AND) BUT (!) the result if the
function in total is false because the ".negate"-flag inverts the result!
Example:
This is a GIFBUILDER object that will write "NEW" on a menu-item if the field "newUntil" has a date less than the current
date!
...
30 = TEXT
30.text = NEW!
30.offset = 10,10
30.if {
value.data = date: U
isLessThan.field = newUntil
negate = 1
}
...
36
TypoScript Reference - doc_core_tsref Functions
typolink
Wraps the incoming value with link.
If this is used from parseFunc the $cObj->parameters-array is loaded with the link-parameters (lowercased)!
Example:
'&print=1'
'&sword_list[]=word1&sword_list[]=word2'
Applications:
This is very useful when linking to pages from a searchresult. The
searchwords are stored in the register-key SWORD_PARAMS and can be
insert directly like this:
.additionalParams.data = register:SWORD_PARAMS
.method: If set to to GET or POST then then the parsed query arguments
(GET or POST data) will be used. This settings are useful if you use URL
processing extensions like Real URL, which translate part of the path into
query arguments.
It's also possible to get both, POST and GET data, on setting this to
"POST,GET" or "GET,POST". The last method in this sequence takes
precedence and overwrites the parts that are also present for the first
method.
37
TypoScript Reference - doc_core_tsref Functions
Examples:
Internal links:
integers (51): creates a link to page with uid = 51
filerefs (fileadmin/somedir/thedoc.html): creates a link to the file on the
local server.
strings (some_alias): creates a link to the page with alias = "some_alias"
External links:
email-adresses (name@email.com): creates a link to the email-addr.
domains (www.domain.com): creates link to http://-page
Now the input can be an alias or page-id. If the input is an integer it will
be treated as a page-id, if there are two comma separated integers, this
indicates a pair of id and type. If there is at least one non numerical
character, this will be recognized as an alias.
Notice: The parameter can contain a keyword that hands over link
generation to an external function. See example below this table!
Target
Target is normally defined by the "extTarget" and "target" properties of
typolink. But you may override this target by adding the new target after
the parameter separated by a whitespace. Thus the target becomes the
second parameter.
If the “Target” parameter is set to the “-” character, then it's the same as
no target passed to the function. This feature enables you to still pass a
class as third parameter and title as fourth parameter without setting the
target also.
Class
If you specify a third parameter separated by whitespace in the parameter
value this becomes the class-parameter of the link. This class parameter is
inserted in the link-tag before any values from .ATagParams which means
this class value will override any class value set in ATagParams (at least for
MSIE). If set to “-”, then it's the same as no class passed to the function.
This feature enables you to still pass a title as fourth parameter without
setting the class also.
38
TypoScript Reference - doc_core_tsref Functions
Examples of multiparameters:
Consider this .parameter value passed to this function:
51 _blank blueLink
<a href="'.$finalTagParts['url'].'"'.
$finalTagParts['targetParams'].
$finalTagParts['aTagParams'].'>
Some TypoScript will usually transfer this value to the “parameter” attribute of the ->typolink call. When “pressrelease:123”
enters ->typolink as the “parameter” it will be checked if “pressrelease” is a keyword with which a link handler is associated
and if so, that handler is allowed to create the link.
Registering the handler for keyword “pressrelease” is done like this:
39
TypoScript Reference - doc_core_tsref Functions
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['typolinkLinkHandler']['pressrelease'] =
'EXT:pressrelease/class.linkHandler.php:&tx_linkHandler';
The class file “pressrelease/class.linkHandler.php“ contains the class “tx_linkHandler” which could look like this:
class tx_linkHandler {
function main($linktxt, $conf, $linkHandlerKeyword, $linkHandlerValue, $link_param, &$pObj) {
$lconf = array();
$lconf['useCacheHash'] = 1;
$lconf['parameter'] = 34;
$lconf['additionalParams'] = '&tx_pressrelease[showUid]='.rawurlencode($linkHandlerValue);
In this function, the value part after the keyword is set as the value of a GET parameter, “&tx_pressrelease[showUid]” and the
“parameter” value of a new ->typolink call is set to “34” which assumes that on page ID 34 a plugin is put that will display
pressrelease 123 when called with &tx_pressrelease[showUid]=123. In addition you can see the “userCacheHash” attribute for
the typolink function used in order to produce a cached display.
The link that results from this operation will look like this:
<a href="index.php?id=34&tx_pressrelease[showUid]=123%3A456&cHash=c0551fead6" >
The link would be encoded with RealURL and respect config.linkVars as long as ->typolink is used to generate the final URL.
textStyle
This is used to style text with a bunch of standard options + some site-specific.
[1] = 1;
[2] = 2;
[3] = 3;
[10] = "+1";
[11] = "-1";
size.default string /stdWrap [default] = User defined
color.field string Set to fieldname from the $cObj->data-array
40
TypoScript Reference - doc_core_tsref Functions
encapsLines
Property: Data type: Description: Default:
encapsTagList list of strings List of tags which qualify as encapsulating tags. Must be lowercase.
Example:
encapsTagList = div, p
This setting will recognize the red line below as encapsulated lines:
<p>Some text</p>
<div>Some text</div>
to
<div>Some text</div>
<div>Some text</div>
([tagname] is in uppercase.)
addAttributes. array of strings Attributes to set in the encapsulation tag.
[tagname]
Example:
addAttributes.P {
style=padding-bottom:0px; margin-top:1px; margin-
bottom:1px;
align=center
}
([tagname] is in uppercase.)
.setOnly =
exists : This will set the value ONLY if the property does not already exist
blank : This will set the value ONLY if the property does not already exist
OR is blank (“”)
This:
becomes this:
41
TypoScript Reference - doc_core_tsref Functions
This:
becomes this:
Example:
encapsLines {
encapsTagList = div,p
remapTag.DIV = P
wrapNonWrappedLines = <P>|</P>
innerStdWrap_all.ifEmpty =
}
This example shows how to handle content rendered by TYPO3 and stylesheets where the <P> tag is used to encapsulate
each line.
Say, you have made this content with the Rich Text Editor:
This is line # 1
After being processed by encapsLines with the above configuration, the content looks like this:
<P>This is line # 1 </P>
<P> </P>
<P>[Above is an empty line!] </P>
<P align="right">This line is right-aligned</P>
Each line is nicely wrapped with <P> tags. The line from the database which was already wrapped (but in <DIV>-tags) has
been converted to <P>, but keeps it's alignment. Overall, notice that the Rich Text Editor ONLY stored the line which was in
fact right-aligned - every other line from the RTE was stored without any wrapping tags, so that the content in the database
remains as human readable as possible.
Example:
# Make sure nonTypoTagStdWrap operates on content outside <typolist> and <typohead> only:
tt_content.text.20.parseFunc.tags.typolist.breakoutTypoTagContent = 1
tt_content.text.20.parseFunc.tags.typohead.breakoutTypoTagContent = 1
# ... and no <BR> before typohead.
tt_content.text.20.parseFunc.tags.typohead.stdWrap.wrap >
# Setting up nonTypoTagStdWrap to wrap the text with P-tags
tt_content.text.20.parseFunc.nonTypoTagStdWrap >
tt_content.text.20.parseFunc.nonTypoTagStdWrap.encapsLines {
encapsTagList = div,p
remapTag.DIV = P
wrapNonWrappedLines = <P style="margin:0 0 0;">|</P>
42
TypoScript Reference - doc_core_tsref Functions
innerStdWrap_all.ifEmpty =
innerStdWrap_all.textStyle < tt_content.text.20.textStyle
}
# finally removing the old textstyle formatting on the whole bodytext part.
tt_content.text.20.textStyle >
# ... and <BR>-tag after the content is not needed either...
tt_content.text.20.wrap >
This is an example of how to wrap traditional tt_content bodytext with <P> tags, setting the line-distances to regular space
like that generated by a <BR> tag, but staying compatible with the RTE features such as assigning classes and alignment to
paragraphs.
tableStyle
This is used to style a table-tag. The input is wrapped by this table-tag
Example:
styles.content.tableStyle {
align.field = text_align
border.field = table_border
cellspacing.field = table_cellspacing
cellpadding = 1
color.field = table_bgColor
color.default = {$styles.content.tableStyle.color}
color.1 = {$styles.content.tableStyle.color1}
color.2 = {$styles.content.tableStyle.color2}
}
43
TypoScript Reference - doc_core_tsref Functions
addParams
Property: Data type: Description: Default:
_offset int Use this to define which tag you want to manipulate. 1
1 is the first tag in the input, 2 is the second, -1 is the last, -2 is the
second last
(array of strings) string /stdWrap This defines the content of each added property to the tag.
If there is a tag-property with this name already (case-sensitive!) that
property will be overridden!
If the returned value is a blank string (but not zero!) then the existing (if
any) property will not be overridden.
[tsref:->addParams]
Example:
page.13 = HTML
page.13.value = <tr><td valign=top>
page.13.value.addParams.bgcolor = {$menuCol.bgColor}
page.13.value.addParams._offset = -1
Result example:
<tr><td valign="top" bgcolor="white">
(This example adds the 'bgColor' property to the value of the HTML cObject, if the content is not “”. (zero counts as a value
here!))
filelink
Input is a filename in the path "path".
icon, size and file is rendered in the listed order.
44
TypoScript Reference - doc_core_tsref Functions
Extra properties:
.secure = [boolean]; If set, then the file pointed to by jumpurl is NOT
redirected to, but rather it's read from the file and returned with a correct
header. This option adds a hash and locationData to the url and there
MUST be access to the record in order to download the file. If the
fileposition on the server is furthermore secured by a .htaccess file
preventing ANY access, you've got secure download here!
Example:
jumpurl.secure = 1
jumpurl.secure.mimeTypes = pdf=application/pdf,
doc=application/msword
target target
stdWrap ->stdWrap
ATagParams <A>-params Additional parameters
/stdWrap
Example:
class=”board”
removePrependedNu boolean if set, any 2-digit prepended numbers (“eg _23”) in the filename is
mbers removed.
altText string /stdWrap For icons (image made with "iconCObject" must have their own properties)
titleText
If no alttext is specified, it will use an empty alttext
emptyTitleHandling string Value can be “keepEmpty” to preserve an empty title attribute, or “useAlt” useAlt
to use the alt attribute instead.
longdescURL string /stdWrap For icons (image made with "iconCObject" must have their own properties)
Example:
1.filelink {
path = uploads/media/
icon = 1
icon.wrap = <td> | </td>
size = 1
size.wrap = <td> | </td>
file.fontTag = {$styles.content.uploads.wrap}
file.wrap = <td> | </td>
jumpurl = 1
target = _blank
stdWrap = <tr> | </tr>
}
parseFunc
This object is used to parse some content for stuff like special typo tags, the "makeLinks"-things and so on...
Example:
This example takes the content of the field "bodytext" and parses it through the makelinks-functions and substitutes all
<LINK> and <TYPOLIST>-tags with something else.
tt_content.text.default {
20 = TEXT
20.field = bodytext
20.wrap = | <BR>
20.brTag = <br>
20.parseFunc {
makelinks = 1
45
TypoScript Reference - doc_core_tsref Functions
makelinks.http.keep = path
makelinks.http.extTarget = _blank
makelinks.mailto.keep = path
tags {
link = TEXT
link {
current = 1
typolink.extTarget = _blank
typolink.target={$cLinkTagTarget}
typolink.wrap = <B><FONT color=red>|</FONT></B>
typolink.parameter.data = parameters : allParams
}
46
TypoScript Reference - doc_core_tsref Functions
Example:
This example is used to split regular bodytext content so that tables and
blockquotes in the bodytext are processed correctly. The blockquotes are
passed into parseFunc again (recursively) and further their top/bottom
margins are set to 0 (so no apparent linebreaks are seen)
The tables are also displayed with a number of properties of the cells
overridden.
tt_content.text.20.parseFunc.externalBlocks {
blockquote.callRecursive=1
blockquote.callRecursive.tagStdWrap.HTMLparser = 1
blockquote.callRecursive.tagStdWrap.HTMLparser {
tags.blockquote.fixAttrib.style.list = margin-
bottom:0;margin-top:0;
tags.blockquote.fixAttrib.style.always=1
}
blockquote.stripNLprev=1
blockquote.stripNLnext=1
table.stripNL=1
table.stdWrap.HTMLparser = 1
table.stdWrap.HTMLparser {
tags.table.overrideAttribs = border=0 cellpadding=2
cellspacing=1 style="margin-top:10px; margin-
bottom:10px;"
tags.tr.allowedAttribs=0
tags.td.overrideAttribs = valign=top
bgcolor="#eeeeee" style="font-family : Verdana, Geneva,
Arial, Helvetica, sans-serif; font-size :
10px;"
}
}
constants boolean The toplevel-defined constants will be substituted in the text. The
constant-name is wrapped in "###".
Example:
constants.EMAIL = email@email.com
(NOTE: This is toplevel TypoScript!)
All cases of the string ###EMAIL### will be substituted in the text. The
constants are defined as a toplevel object.
47
TypoScript Reference - doc_core_tsref Functions
Example:
This substitutes all occurencies of “T3” with “TYPO3 CMS” and “T3web”
with a link to typo3.com.
short {
T3 = TYPO3 CMS
T3web = <a href=”http://typo3.com”>typo3</a>
}
plainTextStdWrap ->stdWrap This is stdWrap properties for all non-tag content.
userFunc function name This passes the non-tag content to a function of your own choice. Similar
to eg. .postUserFunc in stdWrap.
Remember the function name must possibly be prepended “user_”
nonTypoTagStdWrap ->stdWrap Like .plainTextStdWrap. Difference:
.plainTextStdWrap works an ALL non-tag pieces in the text.
.nonTypoTagStdWrap is post processing of all text (including tags)
between special TypoTags (unless .breakoutTypoTagContent is not set for
the TypoTag)
nonTypoTagUserFunc function name Like .userFunc. Differences is (like nonTypoTagStdWrap) that this is post
processing of all content pieces around TypoTags while .userFunc
processes all non-tag content. (Notice: .breakoutTypoTagContent must be
set for the TypoTag if it's excluded from nonTypoTagContent)
sword wrap Marks up any words from the GET-method send array sword_list[] in the <font
text. The word MUST be at least two characters long! color="red">|
NOTE: works only with $GLOBALS["TSFE"]->no_cache==1 </font>
makelinks boolean / Convert webadresses prefixed with "http://" and mail-adresses prefixed
->makelinks with "mailto:" to links.
tags ->tags Here you can define custom tags that will parse the content to
something.
allowTags list of strings List of tags, which are allowed to exist in code!
Highest priority: If a tag is found in allowTags, denyTags is ignored!!
denyTags list of strings List of tags, which may NOT exist in code! (use "*" for all.)
Lowest priority: If a tag is NOT found in allowTags, denyTags is checked.
If denyTags is not "*" and the tag is not found in the list, the tag may
exist!
Example:
This allows <B>, <I>, <A> and <IMG> -tags to exist
.allowTags = b,i,a,img
.denyTags = *
if ->if if "if" returns false the input value is not parsed, but returned directly.
[tsref:->parseFunc]
makelinks
makelinks substitutes all appearances of
http://www.webaddress.rld
mailto:name@email.rld
... to a real linktag
48
TypoScript Reference - doc_core_tsref Functions
tags
Used to create custom tags and define how they should be parsed. This is used in conjunction with parseFunc.
Examples:
tags.bold = TEXT
tags.bold {
current = 1
wrap = <B> | </B>
}
tags.bold.stripNL = 1
[tsref:->tags]
Example:
This example creates 4 custom tags. The <LINK>-, <TYPOLIST>-, <GRAFIX>- and <PIC>-tags
<LINK> is made into a typolink and provides an easy way of creating links in text
<TYPOLIST> is used to create bullet-lists
<GRAFIX> will create a gif-file 90x10 pixels where the text is the content of the tag.
<PIC> lets us place an image in the text. The content of the tag should be the image-reference in "fileadmin/"
tags {
link = TEXT
link {
current = 1
typolink.extTarget = _blank
typolink.target={$cLinkTagTarget}
typolink.wrap = <B><FONT color=red>|</FONT></B>
typolink.parameter.data = parameters : allParams
}
grafix = IMAGE
grafix {
file = GIFBUILDER
file {
49
TypoScript Reference - doc_core_tsref Functions
XY = 90,10
100 = TEXT
100.text.current = 1
100.offset = 5,10
100.nicetext = 1
}
}
pic = IMAGE
pic.file.import = fileadmin/
pic.file.import.current = 1
}
HTMLparser
Property: Data type: Description:
allowTags list of tags Default allowed tags
tags.[tagname] boolean/- Either set this property to 0 or 1 to allow or deny the tag. If you enter
>HTMLparser_tags ->HTMLparser_tags properties, those will automatically overrule this option, thus
it's not needed then.
[tagname] in lowercase.
localNesting list of tags, must be List of tags (among the already set tags), which will be forced to have the nesting-
among preserved tags flag set to true
globalNesting (ibid) List of tags (among the already set tags), which will be forced to have the nesting-
flag set to “global”
rmTagIfNoAttrib (ibid) List of tags (among the already set tags), which will be forced to have the
rmTagIfNoAttrib set to true
noAttrib (ibid) List of tags (among the already set tags), which will be forced to have the
allowedAttribs value set to zero (which means, all attributes will be removed.
removeTags (ibid) List of tags (among the already set tags), which will be configured so they are
surely removed.
keepNonMatchedTags boolean / “protect” If set (true=1), then all tags are kept regardless of tags present as keys in $tags-
array.
If "protect", then the preserved tags have their <> converted to < and >
Default is to REMOVE all tags, which are not specifically assigned to be allowed! So
you might probably want to set this value!
htmlSpecialChars -1 / 0 / 1 / 2 This regards all content which is NOT tags:
“0” means “disabled” - nothing is done
“1” means the content outside tags is htmlspecialchar()'ed (PHP-function which
converts &”<> to &...;)
“2” is the same as “1” but entities like “&” or “ê” are untouched.
“-1” does the opposite of “1” - converts < to <, > to >, " to “ etc.
xhtml_cleaning boolean Cleans up the content for XHTML compliance. Still slightly experimental and
supports only some clean up operations (like convertion tags and attributes to
lower case).
[page:->HTMLparser; tsref:->HTMLparser]
50
TypoScript Reference - doc_core_tsref Functions
HTMLparser_tags
Property: Data type: Description:
overrideAttribs string If set, this string is preset as the attributes of the tag.
allowedAttribs '0' (zero) = no attributes allowed, '[commalist of attributes]' = only allowed
attributes. If blank/not set, all attributes are allowed.
fixAttrib.[attribute].set string Force the attribute value to this value.
fixAttrib.[attribute].unset boolean If set, the attribute is unset.
fixAttrib.[attribute].default string If no attribute exists by this name, this value is set as default value (if this
value is not blank)
fixAttrib.[attribute].always boolean If set, the attribute is always processed. Normally an attribute is processed
only if it exists
fixAttrib.[attribute].trim boolean If any of these keys are set, the value is passed through the respective
fixAttrib.[attribute].intval PHP-functions.
fixAttrib.[attribute].upper
fixAttrib.[attribute].lower
fixAttrib.[attribute].range [low],[high] Setting integer range.
fixAttrib.[attribute].list list of values, Attribute value must be in this list. If not, the value is set to the first
trimmed element.
fixAttrib.[attribute].removeIfFalse boolean/”blank” If set, then the attribute is removed if it is "false". If this value is set to
string "blank" then the value must be a blank string (that means a "zero" value
will not be removed)
fixAttrib.[attribute].removeIfEquals string If the attribute value matches the value set here, then it is removed.
fixAttrib.[attribute].casesensitiveComp boolean If set, the comparison in .removeIfEquals and .list will be case-sensitive. At
this point, it's insensitive.
fixAttrib.[attribute].prefixLocalAnchors integer If the first char is a “#” character (anchor of fx. <a> tags) this will prefix
either a relative or absolute path.
If the value is “1” you will get the absolute path
(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'))
If the value is “2” you will get the relative path (stripping of
t3lib_div::getIndpEnv('TYPO3_SITE_URL'))
Example:
...fixAttrib.href.prefixLocalAnchors = 1
fixAttrib.[attribute].prefixRelPathWith string If the value of the attribute seems to be a relative URL (no scheme like
“http” and no “/” as first char) then that value of this property will be
prefixed the attribute.
Example:
...fixAttrib.src.prefixRelPathWith = http://192.168.230.3/typo3/32/dummy/
fixAttrib.[attribute].userFunc function reference User function for processing of the attribute.
Example:
...fixAttrib.href.userFunc = tx_realurl->test_urlProc
protect boolean If set, the tag <> is converted to < and >
remap string If set, the tagname is remapped to this tagname
rmTagIfNoAttrib boolean If set, then the tag is removed if no attributes happend to be there.
nesting If set true, then this tag must have starting and ending tags in the correct
order. Any tags not in this order will be discarded. Thus
'</B><B><I></B></I></B>' will be converted to '<B><I></B></I>'.
Is the value "global" then true nesting in relation to other tags marked for
"global" nesting control is preserved. This means that if <B> and <I> are
set for global nesting then this string '</B><B><I></B></I></B>' is
converted to '<B></B>'
[page:->HTMLparser_tags; tsref:->HTMLparser_tags]
51
TypoScript Reference - doc_core_tsref Setup
Setup
Top-level objects
Property: Data type: Description: Default:
types readonly Types (internal)
type=99 reserved for plaintext display
resources readonly Resources in list (internal)
sitetitle readonly SiteTitle (internal)
config ->CONFIG Global configuration.
These values are stored with cached pages which means they are also
accessible when retrieving a cached page.
constants ->CONSTANTS Site-specific constants, eg. a general email-adresse. These constants may
be substituted in the text throughout the pages. The substitution is done
by parseFunc. (Option: constants=1)
FEData ->FE_DATA Here you can configure how data submitted from the front-end should be
processed, which script and so on.
includeLibs Array of strings With this you can include php-files with function libraries for use in your
includescript in TYPO3.
Please see the PAGE-object, which has the same property.
Other reserved These toplevel object names are reserved. That means you can risk
TLO's: static_templates to use them:
“plugin” is used for rendering of special content like boards, ecommerce
plugin solutions, guestbooks and so on. Normally set from static_templates.
tt_* Please see separate description below!
temp “tt_*”, eg tt_content (from “content (default)”) is used to render content
styles from tables.
lib “temp” and “styles” are used for conde-libraries you can copy during
_GIFBUILDER parse-time, but they are not saved with the template in cache. "temp" /
"styles" are unset before the template is cached! Therefore use these
names to store temporary data.
“lib” can be used for a “library” of code, you can reference in TypoScript
(unlike “styles” which is unset)
... PAGE Start a new page
Example:
page = PAGE
page.typeNum = 1
Guidelines:
Good, general PAGE object names to use are such as:
page for the main page with content
frameset, frameset2 for framesets.
top, left, menu, right, bottom, border for top and menu frames etc.
This is just recommandations. Especially the name 'page' for the content
bearing page is very common.
... (whatever) If a toplevel-object is not a PAGE-object it could be used as a temporary
repository for setup. In this case you should use the "temp" or "styles"
objects.
"tt_..." is normally used to define the setup of content-records. Eg.
"tt_content" would be used for the tt_content-table as default. See the
"CONTENT"-cObject
[tsref:(TLO)]
52
TypoScript Reference - doc_core_tsref Setup
"CONFIG"
In typo3/sysext/cms/tslib/ this is known as $GLOBALS["TSFE"]->config["config"], thus the property "debug" below is
accessible as $GLOBALS["TSFE"]->config["config"]["debug"].
Example:
config.defaultgetVars {
test.var1.var2.p3 = 15
L = 3
}
linkVars list HTTP_GET_VARS, which should be passed on with links in TYPO3. This is
compiled into a string stored in $GLOBALS["TSFE"]->linkVars
You can specify a range of valid values by appending a () after each value.
If this range does not match, the variable won't be appended to links. This
is very important to prevent that the cache system gets flooded with
forged values.
Example:
config.linkVars = L, print
This will add "&L=[L-value]&print=[print-value]" to all links in TYPO3.
uniqueLinkVars boolean It might happen that TYPO3 generates links with the same parameter 1
twice or more. This is no problem because only the last parameter is used,
thus the problem is just a cosmetic one.
53
TypoScript Reference - doc_core_tsref Setup
Syntax:
[id],[id],... : [MP-var] | [id],[id],... : [MP-var] | ...
Example:
config.MP_defaults = 36,37,48 : 2-207
This will by default add “&MP=2-207” to all links pointing to pages 36,37
and 48
MP_mapRootPoints list of PIDs/ Defines a list of ID numbers from which the MP-vars are automatically
string calculated for the branch.
The result is used just like MP_defaults are used to find MP-vars if none
has been specified prior to the call to t3lib_tstemplate::linkData().
You can specify “root” as a special keyword in the list of IDs and that will
create a map-tree for the whole site (but this may be VERY processing
intensive if there are many pages!).
The order of IDs specified may have a significance; Any ID in a branch
which is processed already (by a previous ID root point) will not be
processed again.
MP_disableTypolinkClosestM boolean If set, the typolink function will not try to find the closest MP value for the
Pvalue id.
renderCharset string Charset used for rendering internally of the page content. It is highly TYPO3_CONF_VA
recommended that this value is the same as the charset of the content RS[BE]
coming from the main data source (eg. the database). Thus you don't [forceCharset] if
need to do any other conversion. found, otherwise
All strings from locallang files and locale strings are (and should be) "iso-8859-1"
converted to "renderCharset" during rendering.
If you need another output charset than the render charset, see
"metaCharset" below.
54
TypoScript Reference - doc_core_tsref Setup
In case caching is not allowed, these headers are sent to avoid client
caching:
• Cache-Control: private
Notice that enabling the browser caches means you have to consider how
log files are written. Because when a page is cached on the client it will not
invoke a request to the webserver, thus not writing the request to the log.
There should be ways to circumvent these problems but they are outside
the domain of TYPO3 in any case.
The background problem is this: In TYPO3 the same URL can show
different content depending on whether a user is logged in or not. If a user
is logged in, cache-headers will never allow client caching. But if the same
URL was visited without a login prior to the login (allowing caching) the
user will still see the page from cache when logged in (and so thinks he is
not logged in anyway)! The only general way to prevent this is to have a
different URL for pages when users are logged in (which the extension
“realurl” can accomplish).
Another way to solve the problem is using this option in combination with
disabling and enabling logins in various sections of the site. In the page
records (“Advanced” page types) you can disable frontend user logins for
branches of the page tree. Since many sites only needs the login in a
certain branch of the page tree, disabling it in all other branches makes it
much easier to use cache-headers in combination with logins; Cache-
headers should simply be sent when logins are not allowed and never be
send when logins are allowed! Then there will never be problems with
logins and same-URLs.
55
TypoScript Reference - doc_core_tsref Setup
Note that the keywords also change the way TYPO3 generates some of the
XHTML tags to ensure valid XML. If you set doctype to a string, then you
must also set config.xhtmlDoctype (see below).
Background:
By default TYPO3 outputs the XML/DOCTYPE in compliance with the
standards of XHTML. However a browser like MSIE will still run in “quirks-
mode” unless the <?xml> and <DOCTYPE> tags are ordered opposite. But
this breaks CSS validation...
With this option designers can decide for themselves what they want then.
page.headerData.1 = TEXT
page.headerData.1.value =
<script>alert(document.compatMode);</script>
config.doctype (
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-
f.dtd">
)
config.xhtmlDoctype = xhtml_11
Default:
same as config.doctype if set to a keyword
56
TypoScript Reference - doc_core_tsref Setup
If set to one of the know keywords then a standard prologue will be set:
“xml_10” XML 1.0 prologue (see above)
“xml_11” XML 1.1 prologue
Special: If you set it to "none" then no attributes will be set at any event.
Example:
config.htmlTag_setParams = xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en-US"
htmlTag_langKey string Allows you to set the language value for the attributes "xml:lang" and en
"lang" in the <html> tag (when using "config.doctype = xhtml*").
The values must follow the format specified in IETF RFC 3066
Example:
config.htmlTag_langKey = en-US
htmlTag_dir string Sets text direction for whole document (useful for display of Arabic,
Hebrew pages).
Basically the value becomes the attribute value of "dir" for the <html> tag.
Values:
rtl = Right-To-Left (for Arabic / Hebrew)
ltr = Left-To-Right (Default for other languages)
Example:
config.htmlTag_dir = rtl
disableImgBorderAttr boolean Returns the 'border' attribute for an <img> tag only if the doctype is not
xhtml_strict, xhtml_11 or xhtml_2 or if the config parameter
'disableImgBorderAttr' is not set
ATagParams <A>- Additional parameters to all links in TYPO3 (excluding menu-links)
params
Example:
To blur links, insert:
onFocus="blurLink(this)"
setJS_openPic boolean If set, the openPic JavaScript function is forced to be included
setJS_mouseOver boolean If set, the over() and out() JavaScript functions are forced to be included
removeDefaultJS boolean / If set, the default JavaScript in the header will be removed.
string The default JavaScript is the blurLink function and browser detection
variables.
Example:
config.removeDefaultJS = external
config.removeDefaultJS = 1
57
TypoScript Reference - doc_core_tsref Setup
Example:
config.minifyJS = 1
inlineStyle2TempFile boolean If set, the inline styles TYPO3 controls in the core are written to a file,
typo3temp/stylesheet_[hashstring].css, and the header will only contain
the link to the stylesheet.
The file hash is based solely on the content of the styles.
Example:
config.inlineStyle2TempFile = 1
meaningfulTempFilePrefix integer If set it will try to render a meaningful prefix before temporary image files.
Works with GIFBUILDER files (taking content from the Gifbuilder TEXT
objects), menus (taking the title of the menu item) and scaled images
(using original filename base).
ftu boolean If set, the "&ftu=...." GET-fallback identification is inserted. false
"&ftu=[hash]" is always inserted in the links on the first page a user hits.
If it turns out in the next hit that the user has cookies enabled, this
variable is not set anymore as the cookies does the job. If no cookies is
accepted the "ftu" remains set for all links on the site and thereby we can
still track the user.
You can also ignore this feature if you're certain, website users will use
cookies.
"ftu" means fe_typo_user ("fe" is "frontend").
mainScript string This lets you specify an alternative "mainScript" which is the document index.php
that TYPO3 expects to be the default doc. This is used in form-tags and
other places where TYPO3 needs to refer directly to the main-script of the
application
pageGenScript resource Alternative page generation script for applications using index_ts.php for typo3/sysext/cms
initialization, caching, stating and so on. This script is included in the global /tslib/pagegen.ph
scope of index_ts.php-script and thus you may include libraries here. p
Always use include_once for libraries.
Remember not to output anything from such an included script. All
content must be set into $TSFE->content. Take a look at
typo3/sysext/cms/tslib/pagegen.php
$TYPO3_CONF_VARS["FE"]["noPHPscriptInclude"]=1;
is set in localconf.php.
debug boolean If set any debug-information in the TypoScript code is output. Currently
this applies only to the menu-objects
58
TypoScript Reference - doc_core_tsref Setup
Examples:
config.message_preview_workspace = <div
class=”previewbox”>Displaying workspace named "%s" (number %s)!
</div>
config.message_preview_workspace = <div
class=”previewbox”>Displaying workspace number %2$s named "%1$s"!
</div>
locale_all string PHP: setlocale("LC_ALL", [value]);
value-examples: deutsch, de_DE, danish, portuguese, spanish, french,
norwegian, italian. See www.php.net for other value. Also on linux, look
at /usr/share/locale/
Example:
This will render dates in danish made with stdWrap/strftime:
locale_all = danish
locale_all = da_DK
sword_standAlone boolean Used by the parseFunc-substitution of search Words (sword):
If set, the words MUST be surrounded by whitespace in order to be
marked up.
sword_noMixedCase boolean Used by the parseFunc-substitution of search Words (sword):
If set, the words MUST be the exact same case as the search word was.
intTarget target Default internal target. Used by typolink if no target is set
extTarget target Default external target. Used by typolink if no extTarget is set _top
fileTarget target Default file link target. Used by typolink if no fileTarget is set.
spamProtectEmailAddresses "ascii" / If set, then all email addresses in typolinks will be encrypted so spam
-10 to 10 bots cannot detect them.
Alternatively you can set this value to the keyword "ascii". This way every
character of the "mailto:" address will be translated to a Unicode HTML
notation. Have a look at the example to see how this works.
Example:
mailto:a@b.c will be converted to
mailto:a@b.c
The big advantage of this method is that it doesn't need any JavaScript!
spamProtectEmailAddresses_ string Substitute label for the at-sign (@). (at)
atSubst
59
TypoScript Reference - doc_core_tsref Setup
Example:
[browser = netscape]
config.compensateFieldWidth = 0.6
[global]
60
TypoScript Reference - doc_core_tsref Setup
Examples:
Content-type: text/vnd.wap.wml
(this will sent a content-header for a WAP-site)
Location: www.typo3.com
(This redirects the page to www.typo3.com)
disablePageExternalUrl boolean If set, pages with doktype “External Url” will not trigger jumpUrl in TSFE.
This may help you to have external urls open inside you framesets.
stat boolean Enable stat logging at all. true
stat_typeNumList int/list List of pagetypes that should be registered in the statistics table, sys_stat. 0,1
If no types are listed, all types are logged.
Default is "0,1" which normally logs all hits on framesets and hits on
content keeping pages. Of course this depends on the template design.
stat_excludeBEuserHits boolean If set a pagehit is not logged if a user is logged in into TYPO3. false
stat_excludeIPList list of If the REMOTE_ADDR is in the list of IP-addresses, it's also not logged.
strings Can use wildcard, eg. “192.168.1.*”
stat_mysql boolean Enable logging to the MySQL table sys_stat. false
stat_apache boolean Enable logging to the logfile "stat_apache_logfile" false
stat_apache_logfile filename This defines the name of the logfile where TYPO3 writes an Apache-style
logfile to. The location of the directory is defined by
$TYPO3_CONF_VARS["FE"]["logfile_dir"] which must exist and be
writable. It can be relative (to PATH_site) or absolute, but in any case it
must be within the regular allowed paths of TYPO3 (meaning for absolute
paths that it must be within the “lockRootPath” set up in
$TYPO3_CONF_VARS).
It is also possible to use date markers in the filename as they are provided
by the PHP function strftime(). This will enable a natural rotation of the
logfiles.
Example:
config.stat_apache_logfile = typo3_%Y%m%d.log
If set to “utf-8”, the page title will be converted to UTF-8 which results
in even more readable titles, if your log analyzing software supports it.
61
TypoScript Reference - doc_core_tsref Setup
TYPO3 will interprete this as the page with alias = "start" and the type is
zero (default):
start.html
Example:
Startpage.23.1.html
instead of the default, "23.1.html", without the title.
simulateStaticDocuments_no boolean If set, then the type-value will not be set in the simulated filename if the
TypeIfNoTitle type value is zero anyways. However the filename must be without a title.
Example:
“Startpage.23.0.html” would still be “Startpage.23.0.html”
“23.0.html” would be “23.html” (that is without the zero)
“23.1.html” would still be “23.1.html”
simulateStaticDocuments_rep string Word separator for URLs generated by simulateStaticDocuments. If set to
lacementChar hyphen, this option allows search engines to index keywords in URLs.
Before TYPO3 4.0 this character was hard-coded to underscore.
62
TypoScript Reference - doc_core_tsref Setup
Example:
You have a news-plugin. The main page has the url “Page_1.228.0.html”
but when one clicks on a news item the url will be “Page_1.228.0.html?
&tx_mininews_pi1[showUid]=2&cHash=b8d239c224” instead.
Now, this URL will not be indexed by external search-engines because of
the query-string (everything after the “?” mark). This property avoids this
problem by encoding the parameters. These are the options:
NOTICE: From TYPO3 3.6.0 the encoding will work only on parameters
that are manually entered in the list set by
.simulateStaticDocuments_pEnc_onlyP (see right below) or those
parameters that various plugins might allow in addition. This is to limit the
run-away risk when many parameters gets combined.
simulateStaticDocuments_pE string A list of variables that may be a part of the md5/base64 encoded part of a
nc_onlyP simulate_static_document virtual filename (see property in the row above).
Example:
simulateStaticDocuments_pEnc_onlyP = tx_maillisttofaq_pi1[pointer], L,
print
-> this will allow the "pointer" parameter for the extension "maillisttofaq"
to be included (in addition to whatever vars the extension sets itself) and
further the parameter "L" (could be language selection) and "print" (could
be print-version).
content_from_pid_allowOutsi boolean Using the “Show content from this page instead” feature allows you to
deDomain insert content from the current domain only. Setting this option will allow
content included from anywhere in the page tree!
absRefPrefix string If this value is set, then all relative links in TypoScript are prepended with
this string. Used to convert relative paths to absolute paths.
Example:
pageRendererTemplateFile =
fileadmin/test_pagerender.html
63
TypoScript Reference - doc_core_tsref Setup
Value must correspond with the key used for backend system language if
there is one. See inside config_default.php or look at the translation page
on TYPO3.org for the official 2-byte key for a given language. Notice that
selecting the official key is important if you want labels in the correct
language from "locallang" files.
If the language you need is not yet a system language in TYPO3 you can
use an artificial string of your choice and provide values for it via the
TypoScript template where the property “_LOCAL_LANG” for most plugins
will provide a way to override/add values for labels. The keys to use must
be looked up in the locallang-file used by the plugin of course.
language_alt string If “config.language” (above) is used, this can be set to another language
key which will be used for labels if a label was not found for the main
language. For instance a brazil portuguese website might specify “pt” as
alternative language which means the portuguese label will be shown if
none was available in the main language, brazil portuguese. This feature
makes sense if one language is incompletely translated and close to
another language.
sys_language_uid int This value points to the uid of a record from the “sys_language” table and
if set, this means that various parts of the frontend display code will select
records which are assigned to this language. See ->SELECT
64
TypoScript Reference - doc_core_tsref Setup
[default] - The system will look for a translation of the page (from
“Alternative Page Language” table) and if it is not found it will fall back to
the default language and display that.
strict - The system will report an error if the requested translation does
not exist. Basically this means that all pages with gray background in the
Web>Info / Localization overview module will fail (they would otherwise
fall back to default language in one or another way)
ignore - The system will stay with the selected language even if the page
is not translated and there's no content available in this language, so you
can handle that situation on your own then.
sys_language_overlay boolean / If set, records from certain tables selected by the CONTENT cObject using
keyword the “languageField” setting will select the default language (0) instead of
any language set by sys_language_uid / sys_language_mode. In addition
the system will look for a translation of the selected record and overlay
configured fields.
The requirements for this is that the table is configured with
“languageField” and “transOrigPointerField” in the [ctrl] section of $TCA.
Also, exclusion of certain fields can be done with the “l10n_mode” directive
in the field-configuration of $TCA.
Keyword:
hideNonTranslated : If this keyword is used a record that has no
translation will not be shown. The default is that records with no
translation will show up in the default language.
sys_language_softMergeIfNo string Setting additional “mergeIfNotBlank” fields from TypoScript.
tBlank
Background:
In TCA you can configure “l10n_mode” - localization mode - for each field.
Two of the options affect how the frontend displays content; The values
“exclude” and “mergeIfNotBlank” (see “TYPO3 Core API” document for
details). The first (“exclude”) simply means that the field when found in a
translation of a record will not be overlaid the default records field value.
The second (“mergeIfNotBlank”) means that it will be overlaid only if it has
a non-blank value.
Since it might be practical to set up fields for “mergeIfNotBlank” on a per-
site basis this options allows you to override additional fields from tables.
Syntax:
[table]:[field], [table]:[field], [table]:[field], ...
Example:
config.sys_language_softMergeIfNotBlank =
tt_content:image , tt_content:header
This setting means that the header and image field of content elements
will be used from the translation only if they had a non-blank value. For
the image field this might be very practical because it means that the
image(s) from the default translation will be used unless other images are
inserted!
65
TypoScript Reference - doc_core_tsref Setup
Fields set in this property will override if the same field is set for
"sys_language_softMergeIfNotBlank".
typolinkCheckRootline boolean If set, then every “typolink” is checked whether it's linking to a page within
the current rootline of the site.
If not, then TYPO3 searches for the first found domain record (without
redirect) in that rootline from out to in.
If found (another domain), then that domain is prepended the link, the
external target is used instead and thus the link jumps to the page in the
correct domain.
typolinkEnableLinksAcrossDo boolean This option enables to create links across domains using current domain's 0
mains linking scheme.
If this option is not set, then all cross-domain links will be generated as
"http://domain.tld/index.php?id=12345" (where 12345 is page id). If this
option is set and current site uses, for example, simulateStatic, then links
will be generated as "http://domain.tld/PageTitle.12345.html" (includes
RTE links too). Setting this option requires that domains, where pages are
linked, have the same configuration for:
- linking scheme (i.e. all use simulateStatic or RealURL or CoolURI but not
any mixture)
- all domains have identical localization settings (config.sys_language_XXX
directives)
- all domains have the same set of languages defined
Example:
config.typolinkLinkAccessRestrictedPages = 29
config.typolinkLinkAccessRestrictedPages_addParams =
&return_url=###RETURN_URL###&pageId=###PAGE_ID###
Will create a link to page with id 29 and add GET parameters where the
return URL and original page id is a part of it.
typolinkLinkAccessRestricted string See “typolinkLinkAccessRestrictedPages” above
Pages_addParams
notification_email_urlmode string This option allows you to handle URL's in plain text emails so long URLS of
more than 76 chars are not broken. This option can be either empty or
“76” or “all”.
If the string is blank, all links in plaintext emails are untouched.
If it's set to 76 then all links longer then 76 characters are stored in the
database and a hash is sent in the GET-var ?RDCT=[md5/20] to the
index.php script which finds the proper link in the database and issues a
location header (redirection).
If the value is “all” then ALL “http://” links in the message are converted.
66
TypoScript Reference - doc_core_tsref Setup
Values possible:
base64
quoted-printable
8bit
notification_email_charset string Alternative charset for the notification mails. ISO-8859-1
admPanel boolean / - If set, the admin panel appears in the bottom of pages.
>ADMPANE
L properties NOTE: In addition the panel must be enabled for the user as well, using
the TSconfig for the user! See adminguide documentation.
Example:
<hr /><b>LOGIN</b>
beLoginLinkIPList_logout HTML HTML code wrapped with the logout link, see above
index_enable boolean Enables cached pages to be indexed.
index_externals boolean If set, external media linked to on the pages is indexed as well.
index_descrLgd int This indicates how many chars to preserve as description for an indexed 200
page. This may be used in the search result display.
index_metatags boolean This allows to turn on or off the indexing of metatags. It is turned on by true
default.
xhtml_cleaning string Tries to clean up the output to make it XHTML compliant and a bit more.
THIS IS NOT COMPLETE YET, but a “pilot” to see if it makes sense
anyways. For now this is what is done:
67
TypoScript Reference - doc_core_tsref Setup
Example:
config.baseURL = http://typo3.org/sub_dir/
tx_[extension key with no - Configuration space for plugins
underscores]_[*]
[tsref:config/->CONFIG]
"CONSTANTS"
Property: Data type: Description: Default:
Array... string Constants.
Examples:
.EMAIL = email@email.com
Now if parseFunc anywhere is configured with constants=1 then all cases
of the string ###EMAIL### will be substituted in the text.
see ->parseFunc
[tsref:constants]
"PAGE"
Pages are referenced by two main values. The "id" and "type".
The "id" points to the uid of the page (or the alias). Thus the page is found.
The "type" is used to define how the page should be rendered. This is primarily used with framesets. Here the frameset
normally has the type=0 (or not set) and the documents in the frameset would be defined with another type, eg. type=1 for
the content-page.
You should explore the framesets of the TYPO3-sites around. Also look in the standard-templates for framesets.
It's a good habit to use type=1 for the main-page of a website with frames. With no-frames sites type is normally zero.
Another good habit is to use "page" as the toplevel-objectname for the content-page on a website.
Most of this codes is executed in the PHP-script pagegen.php
68
TypoScript Reference - doc_core_tsref Setup
Property:
.useCSS = 1 (boolean) - will set a “BODY {margin: ...}” line in the in-
document style declaration - for XHTML compliance.
Example:
value 4
adds leftmargin="4" topmargin="4" marginwidth="4" marginheight="4"
to the bodyTag.
bodyTagAdd string This content is added to the end of the bodyTag.
bgImg imgResource Background image on the page. This is automatically added to the body-
tag.
frameSet ->FRAMESET if any properties is set to this property, the page is made into a
frameset.
meta ->META
shortcutIcon resource Favicon of the page. Create a reference to an icon here!
Browsers that support favicons display them in the browser's address
bar, next to the site's name in lists of bookmarks, and next to the page's
title in a Tabbed Document Interface.
Note:
This must be a valid ".ico"-file (iconfile)
headerData ->CARRAY Inserts content in the header-section. Could be JavaScripts, meta-tags,
other stylesheet references.
By default, gets inserted after all the style definitions.
footerData ->CARRAY Same as headerData above, except that this block gets included at the
bottom of the page (just before the closing body tag).
config ->CONFIG configuration for the page. Any entries override the same entries in the
toplevel-object "config".
includeLibs array of strings With this you may include php-files. This does the same as
"includeLibrary" in ->CONFIG but this can include more than one file.
These files are included after the file of includeLibrary.
NOTE:
The toplevel object "includeLibs" and the scripts defined with this
property is added to each other. Script-keys (that is the "array of
strings"-value, like below "tx_myext") from this property of the page
overrides any scripts-keys from the toplevel "includeLibs" property!
The script-filenames are of the datatype "resource".
Example:
includeLibs.tx_myext = lib_filename.php
JavaScript:
69
TypoScript Reference - doc_core_tsref Setup
javascriptLibs {
# include prototype
Prototype = 1
# include Scriptaculous
Scriptaculous = 1
# adds modules dragdrop and controls to
Scriptaculous
Scriptaculous.modules = dragdrop,controls
# include ExtCore
ExtCore = 1
# include ExtCore debug file (uncompressed)
ExtCore.debug = 1
# includes ExtJS
ExtJs = 1
# include ext-all.css
ExtJs.css = 1
# include default theme
ExtJs.theme = 1
# load specific adapter (jquery|prototype|yui)
ExtJs.adapter = …
# initialize QuickTips
ExtJs.quickTips = 1
# includes ExtJS debug file (uncompressed)
ExtJs.debug = 1
}
inlineLanguageLabel array of strings ExtJS specific, adds language labels to the page.
Example:
inlineLanguageLabel {
label1 = 123
label2 = 456
}
TYPO3.lang = {"label1":"123","label2":"456"};
inlineSettings array of strings ExtJS specific, adds settings to the page.
Example:
page.inlineSettings {
setting1 = Hello
setting2 = GoOnTop
}
TYPO3.settings = {"TS":
{"setting1":"Hello","setting2":"GoOnTop"}};
extOnReady ->CARRAY ExtJS specific, adds inline javascript, wrapped in Ext.onReady.
Example:
page.extOnReady {
10 = TEXT
10.value = Ext.Msg.alert("Typoscript
Message","Hello World!");
}
Ext.onReady(function() {Ext.Msg.alert("Typoscript
Message","Hello World!"); });
70
TypoScript Reference - doc_core_tsref Setup
Example:
includeJSlibs.twitter =
http://twitter.com/javascripts/blogger.js
includeJSlibs.twitter.external = 1
includeJSFooterlibs. resource Same as includeJSlibs above, except that this block gets included at the
[array] bottom of the page (just before the closing body tag).
includeJS.[array] resource Inserts one or more (Java)Scripts in <script> tags.
Example:
includeJS {
file1 = fileadmin/helloworld.js
file1.type = application/x-javascript
file2 = javascript_uploaded_to_template*.js
}
includeJSFooter. resource Same as includeJS above, except that this block gets included at the
[array] bottom of the page (just before the closing body tag).
jsInline ->CARRAY Use cObjects for creating inline JavaScript
Example:
page.jsInline {
10 = TEXT
10.dataWrap = var pageId = {TSFE:id};
}
Note:
with config.removeDefaultJS = external, the inlineJS is moved to
external file.
with config.minifyJS = 1, the jsInline will be minified as well.
jsFooterInline ->CARRAY Same jsInline above, except that the JavaScript gets inserted at the
bottom of the page (just before the closing body tag).
inlineJS ->CARRAY Inserts inline Javascript in the header-section. Don't use script-tags as
they are added by TYPO3.
Example:
page.inlineJS.10 = TEXT
page.inlineJS.10.value = function a(val)
{ alert(val); }
CSS Stylesheets:
71
TypoScript Reference - doc_core_tsref Setup
Example:
includeCSS {
file1 = fileadmin/mystylesheet1.css
file2 = stylesheet_uploaded_to_template*.css
file2.title = High contrast
file2.media = print
ie6Style = fileadmin/css/style3.css
ie6Style.allWrap = <!--[if lte IE 7]>|<![endif]-->
cooliris = http://www.cooliris.com/shared/
resources/css/global.css
cooliris.external = 1
}
cssInline ->CARRAY Use cObjects for creating inline CSS
Example:
cssInline {
10 = TEXT
10.value = h1 {margin:15px;}
20 = TEXT
20.value = h1 span {color: blue;}
}
CSS_inlineStyle string This value is just passed on as inline css (in-document css encapsulated
in <style>-tags)
insertClassesFromRTE boolean If set, the classes for the Rich Text Editor configured in Page TSconfig is
inserted in as the first thing in the Style-section right after the setting of
the stylesheet.
Example:
page.hoverStyle = font: bold; text-decoration: none;
72
TypoScript Reference - doc_core_tsref Setup
Tip:
Use this together with the config-option "compensateFieldWidth" set to
"0.6" for netscape-browsers in order to render the small form fields in
the same width!
"FE_DATA"
Property: Data type: Description: Default:
array of tableNames ->FE_TABLE
[tsref:FEData]
"FE_TABLE"
Property: Data type: Description: Default:
default.[field] string This property is in charge of which default-values is used for the table:
Example:
This defines the default values used for new records. These values will
be overridden with any value submitted instead (as long as the
submitted fields are allowed due to "allowNew")
default {
subject = This is the default subject value!
hidden = 1
parent = 0
}
allowNew.[field] string This property is in charge of which fields that may be written from the
frontend.
Example:
This defines that subject is a field, that may be submitted from the
frontend. If a value is not submitted, subject is filled with the default
value (see above).
The field "hidden" on the other hand cannot be changed from the
frontend. "hidden" will gain the value from the default definition (see
above). If fields are set to "0" (zero) it's the same as if they were not
defined in this array.
allowNew {
subject = 1
hidden = 0
}
allowEdit.[field] string Same as above ("allowNew") but this controls which fields that may be
written in case of an update of a record (and not a new submission)
Please pay attension to the property below! ("overrideEdit")
overrideEdit.[field] string This works like default-values above but is values inserted after the
submitted values has beed processed. This means that opposite to
default-values overwritten by the submitted values, these values
override the submitted values.
Example:
In this case overrideEdit secures that if a user updates his record (if he
"own" it) the "hidden"-field will be set no matter what.
overrideEdit {
hidden = 1
}
userIdColumn string (field) This is a string that points to the column of a record where the user-id
of the current fe_user should be inserted. This fe_user-uid is
inserted/updated both by "new" and "edit"
73
TypoScript Reference - doc_core_tsref Setup
"FRAMESET"
Property: Data type: Description: Default:
1,2,3,4... frameObj Configuration of frames and nested framesets.
cols <frameset>-data:cols Cols
rows <frameset>- Rows
data:rows
params <frameset>-params Example:
border="0" framespacing="0" frameborder="NO"
[tsref:(page).frameSet/->FRAMESET]
"FRAME"
Property: Data type: Description: Default:
obj pointer to toplevel toplevel object-name of a PAGE / FRAMESET
object-name
Example:
"left", "page", "frameset"
options url-parameters Example:
print=1&othervar=anotherthing
would add '&print=1&othervar=anotherthing' to the ".src"-content (if
not ".src" is set manually!!)
params <frame>-params Example:
scrolling="AUTO" noresize frameborder="NO"
name <frame>-data:name Manually set name of frame value of ".obj"
page = PAGE
page.typeNum = 1
74
TypoScript Reference - doc_core_tsref Setup
top = PAGE
top.typeNum = 3
frameset.frameSet.rows = 150,*
frameset.frameSet.params = border="0" framespacing="0" frameborder="NO"
frameset.frameSet {
1 = FRAME
1.obj = top
1.params = scrolling="NO" noresize frameborder="NO" marginwidth="0" marginheight="0"
2 = FRAME
2.obj = page
2.params = scrolling="AUTO" noresize frameborder="NO"
}
"META"
Property: Data type: Description: Default:
Array... string /stdWrap Metatags
If value is empty (after trimming) the metatag is not generated.
If the "key" (eg. "REFRESH" or "DESCRIPTION") is "REFRESH"
(caseinsensitive), then the "http-equiv"-attribute is used in the metatag
instead of "name".
Examples:
.REFRESH = [sec]; [url, leave blank for same page]
.DESCRIPTION = This is the description of the content in this document
.KEYWORDS = This is the keywords...
[tsref:->META]
"CARRAY"
Property: Data type: Description: Default:
1,2,3,4... cObject This is a numerical "array" of content-objects (cObjects). The order by
which you specific the objects is not important as the array will be
sorted before it's parsed!
Occational properties:
(stdWrap NOTE: This applies ONLY if "CARRAY /stdWrap" is set to be data type
properties...) If you specify any non-integer properties to a CARRAY, stdWrap will be
invoked with all properties of the CARRAY.
Example:
This will return '<B>This will be rendered before "10"testing</B>'
10 = TEXT
10.value = testing
5 = HTML
5.value = This will be rendered before "10"
wrap = <B> |</B>
(TDParams) <TD>-params NOTE: This applies ONLY if "CARRAY +TDParams" is set to be data
type
This property is used only in some cases where CARRAY is used. Please
look out for a note about that in the various cases.
[tsref:->CARRAY]
75
TypoScript Reference - doc_core_tsref Content Objects (cObject)
IMPORTANT NOTE :
When dealing with "cObjects", you're allowed to use a special syntax in order to reuse cObjects without actually creating a
copy. This has the advantage of minimizing the size of the cached template. But on the other hand it doesn't give you the
flexibility of overriding values.
This example will show you how it works:
#
# Temporary objects are defined:
#
lib.stdheader = COA
lib.stdheader {
stdWrap.wrapAlign.field = header_position
stdWrap.typolink.parameter.field = header_link
stdWrap.fieldRequired = header
1 = TEXT
1.current = 1
1.fontTag = {$content.wrap.header1}
stdWrap.space = {$content.headerSpace}
}
#
# CType: header
#
tt_content.header = COA
tt_content.header {
10 < lib.stdheader
10.stdWrap.space >
20 = TEXT
20.field = subheader
20.fontTag = {$content.wrap.subheader1}
}
#
# CType: bullet
#
tt_content.bullets = COA
tt_content.bullets {
10 = < lib.stdheader
20 < styles.content.bulletlist_gr
}
Comment: First lib.stdheader is defined. This is (and must be) a cObject ! (in this case, COA).
Now lib.stdheader is copied to tt_content.header.10 with the "<" operator. This means that an actual copy of lib.stdheader is
created at parsetime.
But this is not the case with tt_content.bullets.10. Here lib.stdheader is just pointed to and lib.stdheader will be used as the
cObject at runtime.
The reason why lib.stdheader was copied in the first case is the fact that it's needed to unset ".stdWrap.space" inside the
cObject ("10.stdWrap.space >"). This could NOT be done in the second case where only a pointer is created.
NOTE:
If lib.stdheader was temp.stdheader instead, the pointer would not work! This is due to the fact that the runtime-reference
would find nothing in "temp." as this is unset before the template is stored in cache!
76
TypoScript Reference - doc_core_tsref Content Objects (cObject)
This goes for "temp." and "styles." (see the toplevel object definition elsewhere)
Overriding values anyway:
Although you can not override values TypoScript-style (using the operators and all) the properties of the object which has the
reference will be merged with the config of the reference.
Example:
page.10 = TEXT
page.10.value = kasper
page.10.case = upper
Notice that .value was not cleared (the red line), because it's simply two arrays which are joined:
77
TypoScript Reference - doc_core_tsref Content Objects (cObject)
HTML
Property: Data type: Description: Default:
value HTML /stdWrap Raw HTML-code.
[tsref:(cObject).HTML]
Example:
10 = HTML
10.value = This is a text in uppercase
10.value.case = upper
Example:
10 = HTML
10.value.field = bodytext
10.value.br = 1
TEXT
TEXT is very similar to the cObject "HTML". But the stdWrap is on the very rootlevel of the object. This is non-standard. Check
the example.
Example:
10 = TEXT
10.value = This is a text in uppercase
10.case = upper
Example:
10 = TEXT
10.field = bodytext
10.br = 1
Example:
temp.menutable = COBJ_ARRAY
temp.menutable {
10 = HTML
10.value = <table border=0 cellpadding=0 cellspacing=0>
78
TypoScript Reference - doc_core_tsref Content Objects (cObject)
20 = HMENU
20.entryLevel = 0
20.1 = GMENU
20.1.NO {
wrap = <tr><td> | </td></tr>
XY = {$menuXY}
backColor = {$bgCol}
20 = TEXT
20 {
text.field = title
fontFile = media/fonts/hatten.ttf
fontSize = 23
fontColor = {$menuCol}
offset = |*| 5,18 || 25,18
}
}
30 = HTML
30.value = </table>
}
FILE
PHP-function: $this->fileResource()
Example:
In this example a page is defined, but the content between the body-tags comes directly from the file "gs.html":
page.10 = FILE
page.10.file = fileadmin/gs/gs.html
79
TypoScript Reference - doc_core_tsref Content Objects (cObject)
IMAGE
PHP-function: $cObj->cImage();
The array $GLOBALS["TSFE"]->lastImageInfo is set with the info-array of the returning image (if any) and contains width,
height and so on.
Example:
10 = IMAGE
10.file = toplogo*.gif
10.params = hspace=5
10.wrap = |<BR>
IMG_RESOURCE
Returns only the image-reference, possibly wrapped with stdWrap. May be used for putting background images in tables or
table-rows or to import a image in your own include-scripts.
The array $GLOBALS["TSFE"]->lastImgResourceInfo is set with the info-array of the resulting image resource (if any) and
contains width, height and so on.
CLEARGIF
Inserts a transparent gif-file.
80
TypoScript Reference - doc_core_tsref Content Objects (cObject)
Example:
20 = CLEARGIF
20.height=20
CONTENT
This object is designed to generate content by making it possible to finely select records and rendering them.
The register-key SYS_LASTCHANGED is updated with the tstamp-field of the records selected which has a higher value than
the current.
Possible values are “-1” (slide back up to the siteroot), “1” (only the
current level) and “2” (up from one level back).
// Configuration for records with the typeField-value (often "CType") set to "bullets"
// If field "layout" is set to "1" or "2" a special configuration is use, else default
tt_content.bullets.subTypeField = layout
tt_content.bullets.default {
.....
}
tt_content.bullets.1 {
.....
}
tt_content.bullets.2 {
.....
}
// This is what happens if the typeField-value does not match any of the above
tt_content.default.default {
.....
}
81
TypoScript Reference - doc_core_tsref Content Objects (cObject)
RECORDS
This object is meant for displaying lists of records from a variety of tables. Contrary to the CONTENT object, it does not allow
for very fine selections of records (it has no “select” property)
The register-key SYS_LASTCHANGED is updated with the tstamp-field of the records selected which has a higher value than
the current.
NOTE: Records with parent ids (pid's) for non-accessible pages (that is hidden, timed or access-protected pages) are normally
not selected. Pages may be of any type, except recycler. Disable the check with the "dontCheckPid"-option.
Example:
tables = tt_content, tt_address, tt_links
conf.tx_myexttable = TEXT
conf.tx_myexttable.value = Hello world
Example:
20 = RECORDS
20.source.field = records
20.tables = tt_address
20.conf.tt_address < tt_address.default
82
TypoScript Reference - doc_core_tsref Content Objects (cObject)
HMENU
Generates hierarchical menus.
Example:
temp.sidemenu = HMENU
temp.sidemenu.1 = GMENU
cache_period int The number of seconds a menu may remain in cache. If this
value is not set, the first available value of the following will be
used:
1) cache_timeout of the current page
2) config.cache_period defined globally
3) 86400 (= 1 day)
entryLevel int /stdWrap Defines at which level in the rootLine, the menu should start. 0
Default is "0" which gives us a menu of the very first pages on
the site.
If the value is < 0, entryLevel is chosen from "behind" in the
rootLine. Thus "-1" is a menu with items from the outermost
level, "-2" is the level before the outermost...
special "directory" / (See separate table below)
"list" /
"updated" /
"browse" /
"rootline" /
"keywords" /
“language”
special.value list of page-uid's See above
/stdWrap
minItems int The minimum items in the menu. If the number of pages does
not reach this level, a dummy-page with the title "..." and
uid=[currentpage_id] is inserted.
Notice: Affects all sub menus as well. To set the value for each
menu level individually, set the properties in the menu objects
(see “Common properties” table).
maxItems int The maximum items in the menu. More items will be ignored.
Example:
This results in a menu, where the first two items are skipped
starting with item number 3:
begin = 3
Example:
The pages with these uid-number will NOT be within the menu!!
Additionally the current page is always excluded too.
excludeUidList = 34,2,current
excludeDoktypes list of integers Enter the list of page document types (doktype) to exclude from 5,6
menus. By default pages that are “not in menu” (5) are
excluded and those marked for backend user access only (6).
includeNotInMenu boolean If set, pages with the checkbox “Not in menu” checked will be
included in menus.
83
TypoScript Reference - doc_core_tsref Content Objects (cObject)
Keyword: “all”
When set to “all” the same check is carried out but it will not
look if “Hide page if no translation for current language exists”
is set - it always reverts to default language if no translation is
found.
Example:
temp.sidemenu = HMENU
temp.sidemenu.entryLevel = 1
temp.sidemenu.1 = TMENU
temp.sidemenu.1 {
target = page
NO.afterImg = media/bullets/dots2.gif |*||*| _
NO.afterImgTagParams = hspace="4"
NO.linkWrap = {$fontTag}
NO.ATagBeforeWrap = 1
special.directory
A HMENU of type special = directory lets you create a menu listing the subpages of one or more parent pages. The parent
pages are defined in the property “.value”. It is usually used for sitemaps.
Mount pages are supported.
84
TypoScript Reference - doc_core_tsref Content Objects (cObject)
special.list
A HMENU of type special = list lets you create a menu that lists the pages you define in the property “.value”.
Mount pages are supported.
20 = HMENU
20.special = list
20.special.value = 35, 56
special.updated
A HMENU with the property special = updated will create a menu of the most recently updated pages.
A note on ordering: The sorting menu is by default done in reverse order (desc) with the field specified by “mode”, but
setting “alternativeSortingField” for the menu object (eg TMENU or GMENU, see later) will override that.
Mount pages are supported.
85
TypoScript Reference - doc_core_tsref Content Objects (cObject)
20 = HMENU
20.special = updated
20.special.value = 35, 56
20.special {
mode = tstamp
depth = 2
maxAge = 3600*24*3
limit = 8
}
special.rootline
A HMENU with the property special = rootline creates a rootline menu (also known as “breadcrumb trail”) that could look like
this:
Page level 1 > Page level 2 > Page level 3 > Current page
(For a description of “rootline” see further up in this document.)
Mount pages are supported.
page.2 = HMENU
page.2.special = rootline
page.2.special.range = 1|-2
page.2.special.targets.3 = page
page.2.1 = TMENU
page.2.1.target = _top
page.2.1.wrap = <HR> | <HR>
page.2.1.NO {
linkWrap = | >
}
[tsref:(cObject).HMENU.special.rootline]
special.browse
Warning: Mount pages are not supported!
This kind of menu is built of items given by a list from the property ".item".
Ordering is by default done in reverse order (desc) with the field specified by “mode” , but setting “alternativeSortingField” for the menu
object (eg GMENU, see later) will override that.
86
TypoScript Reference - doc_core_tsref Content Objects (cObject)
Reserved itemnames:
next / prev : links to next page / previous page. Next and previous
pages are from the same "pid" as the current page id (or "value") -
that is the next item in a menu with the current page. Also referred to
as current level.
If ".prevnextToSection" is set then next/prev will link to the first page
of next section / last page of previous section.
nextsection / prevsection : links to next section / previous section.
A section is defined as the subpages of a page on the same level as
the parent (pid) page of the current page. Will not work if parent page
of current page is the root page of the site.
nextsection_last | prevsection_last: Where
nextsection/prevsection links to the first page in a section, these links
to the last pages. If there is only one page in the section that will be
both first and last. Will not work if parent page of current page is the
root page of the site.
first / last : First / Last page on current level. If there is only one
page on the current level that page will be both first and last.
up : Links to the parent (pid) page of the current page. (up 1 level)
Will always be available
index : Links to the parent of the parent page of the current page (up
2 levels). May not be available if that page is out of the rootline.
Examples:
special.keywords
Makes a menu of pages with one or more keywords also found on the current page.
Mount pages are supported.
87
TypoScript Reference - doc_core_tsref Content Objects (cObject)
special.language
Creates a language selector menu. Typically this is made as a menu with flags for each language a page is translated to and
when the user clicks any element the same page id is hit but with a change to the “&L” parameter in the URL.
The “language” type will create menu items based on the current page record but with the language record for each language
overlaid if available. The items all link to the current page id and only “&L” is changed.
Note on item states:
When “TSFE->sys_language_uid” matches the sys_language uid for an element the state is set to “ACT”, otherwise “NO”.
However, if a page is not available due to the pages “Localization settings” (which can disable translations) or if no Alternative
Page Language record was found (can be disabled with “.normalWhenNoLanguage”, see below) the state is set to
“USERDEF1” for non-active items and “USERDEF2” for active items. So in total there are four states to create designs for. It is
recommended to disable the link on menu items rendered with “USERDEF1” and “USERDEF2” in this case since they are
disabled exactly because a page in that language does not exist and might even issue an error if tried accessed (depending on
site configuration).
Example
Creates a language menu with flags (notice that some lines break):
lib.langMenu = HMENU
lib.langMenu.special = language
lib.langMenu.special.value = 0,1,2
lib.langMenu.1 = GMENU
lib.langMenu.1.NO {
XY = [5.w]+4, [5.h]+4
backColor = white
88
TypoScript Reference - doc_core_tsref Content Objects (cObject)
5 = IMAGE
5.file = media/flags/flag_uk.gif || media/flags/flag_fr.gif || media/flags/flag_es.gif
5.offset = 2,2
}
special.userdefined
Lets you write your own little PHP-script that generates the array of menuitems.
Howto:
You must populate an array called $menuItemsArray with page-records of the menuitems you want to be in the menu.
It goes like this:
$menuItemsArray[] = pageRow1;
$menuItemsArray[] = pageRow2;
$menuItemsArray[] = pageRow3;
...
A “pageRow” is a record from the table “pages” with all fields selected (SELECT * FROM...)
If you create fake page rows, make sure to add at least “title” and “uid” field values.
Notice:
If you work with mount-points you can set the MP param which should be set for the page by setting the internal field
“_MP_PARAM” in the page-record (xxx-xxx).
Overriding URLs:
You can also use the internal field "_OVERRIDE_HREF" to set a custom href-value (eg. "http://www.typo3.org") which will in
any case be used rather than a link to the page that the page otherwise might represent. If you use "_OVERRIDE_HREF" then
"_OVERRIDE_TARGET" can be used to override the target value as well (See example below).
Other reserved keys:
“_ADD_GETVARS” can be used to add get parameters to the URL, eg. “&L=xxx”.
“_SAFE” can be used to protect the element to make sure it is not filtered out for any reason.
Creating submenus:
You can create submenus for the next level easily by just adding an array of menu items in the internal field "_SUB_MENU"
(See example below).
Presetting element state
If you would like to preset an element to be recognized as a SPC, IFSUB, ACT, CUR or USR mode item, you can do so by
specifying one of these values in the key “ITEM_STATE” of the page record. This setting will override the natural state-
evaluation.
special.userfunction
Calls a user function/method in class which should (as with “userdefined” above) return an array with page records for the menu.
Property: Data type: Description: Default:
userFunc string Name of the function
[tsref:(cObject).HMENU.special.userfunction]
89
TypoScript Reference - doc_core_tsref Content Objects (cObject)
First, this listing creates a menu in three levels where the first two are graphical items:
0: # ************************
1: # MENU LEFT
2: # ************************
3: lib.leftmenu.20 = HMENU
4: lib.leftmenu.20.special = userfunction
5: lib.leftmenu.20.special.userFunc = user_3dsplm_pi2->makeMenuArray
6: lib.leftmenu.20.1 = GMENU
7: lib.leftmenu.20.1.NO {
8: wrap = <tr><td>|</td></tr><tr><td class="bckgdgrey1" height="1"></td></tr>
9: XY = 163,19
10: backColor = white
11: 10 = TEXT
12: 10.text.field = title
13: 10.text.case = upper
14: 10.fontColor = red
15: 10.fontFile = fileadmin/fonts/ARIALNB.TTF
16: 10.niceText = 1
17: 10.offset = 14,12
18: 10.fontSize = 10
19: }
20: lib.leftmenu.20.2 = GMENU
21: lib.leftmenu.20.2.wrap = | <tr><td class="bckgdwhite" height="4"></td></tr><tr><td
class="bckgdgrey1" height="1"></td></tr>
22: lib.leftmenu.20.2.NO {
23: wrap = <tr><td class="bckgdwhite" height="4"></td></tr><tr><td>|</td></tr>
24: XY = 163,16
25: backColor = white
26: 10 = TEXT
27: 10.text.field = title
28: 10.text.case = upper
29: 10.fontColor = #666666
30: 10.fontFile = fileadmin/fonts/ARIALNB.TTF
31: 10.niceText = 1
32: 10.offset = 14,12
33: 10.fontSize = 11
34: }
35: lib.leftmenu.20.2.RO < lib.leftmenu.20.2.NO
36: lib.leftmenu.20.2.RO = 1
37: lib.leftmenu.20.2.RO.backColor = #eeeeee
38: lib.leftmenu.20.2.ACT < lib.leftmenu.20.2.NO
39: lib.leftmenu.20.2.ACT = 1
40: lib.leftmenu.20.2.ACT.10.fontColor = red
41: lib.leftmenu.20.3 = TMENU
42: lib.leftmenu.20.3.NO {
43: allWrap = <tr><td>|</td></tr>
44: linkWrap (
45: <table border="0" cellpadding="0" cellspacing="0" style="margin: 2px; 0px; 2px; 0px;">
46: <tr>
47: <td><img src="clear.gif" width="15" height="1" /></td>
48: <td><img src="fileadmin/arrow_gray.gif" height="9" width="9" hspace="3" /></td>
49: <td>|</td>
50: </tr>
51: </table>
52: )
53: }
90
TypoScript Reference - doc_core_tsref Content Objects (cObject)
The TypoScript code above generates this menu, but the items does not link straight to pages as usual. This is because the
whole menu is generated from this array, which was returned from the function "menuMenuArray" called in TypoScript line
4+5
1: function makeMenuArray($content,$conf) {
2: return array(
3: array(
4: 'title' => 'Contact',
5: '_OVERRIDE_HREF' => 'index.php?id=10',
6: '_SUB_MENU' => array(
7: array(
8: 'title' => 'Offices',
9: '_OVERRIDE_HREF' => 'index.php?id=11',
10: '_OVERRIDE_TARGET' => '_top',
11: 'ITEM_STATE' => 'ACT',
12: '_SUB_MENU' => array(
13: array(
14: 'title' => 'Copenhagen Office',
15: '_OVERRIDE_HREF' => 'index.php?id=11&officeId=cph',
16: ),
17: array(
18: 'title' => 'Paris Office',
19: '_OVERRIDE_HREF' => 'index.php?id=11&officeId=paris',
20: ),
21: array(
22: 'title' => 'New York Office',
23: '_OVERRIDE_HREF' => 'http://www.newyork-office.com',
24: '_OVERRIDE_TARGET' => '_blank',
25: )
26: )
27: ),
28: array(
29: 'title' => 'Form',
30: '_OVERRIDE_HREF' => 'index.php?id=10&cmd=showform',
31: ),
32: array(
33: 'title' => 'Thank you',
34: '_OVERRIDE_HREF' => 'index.php?id=10&cmd=thankyou',
35: ),
36: ),
37: ),
38: array(
39: 'title' => 'Products',
40: '_OVERRIDE_HREF' => 'index.php?id=14',
41: )
42: );
43: }
Notice how the array contains "fake" page-records which has no uid field, only a "title" and "_OVERRIDE_HREF" as required and some other
fields as it fits.
• The first level with items "Contact" and "Products" contains "title" and "_OVERRIDE_HREF" fields, but "Contact" extends this by a
"_SUB_MENU" array which contains a similar array of items.
• The first item on the second level, "Offices", contains a field called "_OVERRIDE_TARGET". Further the item has its state set to "ACT"
which means it will render as an "active" item (you will have to calculate such stuff manually when you are not rendering a menu of real
pages!). Finally there is even another sub-level of menu items.
91
TypoScript Reference - doc_core_tsref Content Objects (cObject)
CTABLE
Creates a standard-table where you can define the content of the the various cells
Example:
page.10 = CTABLE
page.10 {
offset = 5, 0
tableParams = border=0 width=400
cWidth=400
c.1 = CONTENT
c.1.table = tt_content
c.1.select {
pidInList = this
orderBy = sorting
}
OTABLE
Property: Data type: Description: Default:
offset x,y Offset from upper left corner
Note:
Actually the datatype is “x,y,r,b,w,h”:
x,y is offset from upperleft corner
r,b is offset (margin) to right and bottom
w is the required width of the content field
h is the required height of the content field
Example:
top.100 = OTABLE
top.100.offset = 310,8
top.100.tableParams = border=0 cellpadding=0 cellspacing=0
top.100.1 < temp.topmenu
92
TypoScript Reference - doc_core_tsref Content Objects (cObject)
COLUMNS
Property: Data type: Description: Default:
tableParams <TABLE>-params border=0
cellspacing=0
cellpadding=0
TDparams <TD>-params valign=top
rows int (Range: 2-20) The number of rows in the columns. 2
totalWidth int The total-width of the columns+gaps
gapWidth int /stdWrap Width of the gap between columns.
+optionSplit 0 = no gap
gapBgCol HTML-color background-color for the gap-tablecells
/stdWrap
+optionSplit
gapLineThickness int /stdWrap lineThickness of the dividerline in the gap between cells
+optionSplit 0 = no line
gapLineCol HTML-color Line color black
/stdWrap
+optionSplit
[column-number] cObject This is the content-object for each column!!
1,2,3,4...
after cObject This is a cObject placed after the columns-table!!
if ->if if "if" returns false the columns are not rendered!
stdWrap ->stdWrap
[tsref:(cObject).COLUMNS]
HRULER
Property: Data type: Description: Default:
lineThickness int /stdWrap Range: 1-50 1
lineColor HTML-color The color of the ruler. black
spaceLeft pixels space before the line (to the left)
spaceRight pixels space after the line (to the right)
tableWidth string Width of the ruler (“width” attribute in a table) 99%
stdWrap ->stdWrap
[tsref:(cObject).HRULER]
93
TypoScript Reference - doc_core_tsref Content Objects (cObject)
IMGTEXT
This object is designed to align images and text. This is normally used to render text/picture records from the tt_content table.
The image(s) are placed in a table and the table is placed before, after or left/right relative to the text.
See code examples.
0 - Above: Centre
1 - Above: Right
2 - Above: Left
8 - Below: Centre
9 - Below: Right
10 - Below: Left
17 - In Text: Right
18 - In Text: Left
25 - In Text: Right (no wrap)
26 - In Text: Left (no wrap)
textMargin pixels /stdWrap margin between the image and the content
textMargin_outOfText boolean If set, the textMargin space will still be inserted even if the image is placed
above or below the text.
This flag is only for a kind of backwards compatibility because this
"feature" was recently considered a bug and thus corrected. So if anyone
has depended on this way things are done, you can compensate with this
flag.
imgList list of imagefiles list of images from ".imgPath"
/stdWrap
Example:
This imports the list of images from tt_content's image-field
"imgList.field = image"
imgPath path /stdWrap Path to the images
Example:
"uploads/pics/"
imgMax int /stdWrap max number of images
imgStart int /stdWrap start with image-number ".imgStart"
imgObjNum imgObjNum Here you define, which IMAGE-cObjects from the array "1,2,3,4..." in this
+optionSplit object that should render the images.
"current" is set to the image-filename.
Example:
"imgObjNum = 1 |*||*| 2":
This would render the first two images with "1. ..." and the last image with
"2. ...", provided that the ".imgList" contains 3 images.
1,2,3,4 ->IMAGE (cObject) Rendering of the images
The register "IMAGE_NUM" is set with the number of image being
rendered for each rendering of a image-object. Starting with zero.
The image-object should not be of type GIFBUILDER!
Important:
"file.import.current = 1" fetches the name of the images!
caption ->CARRAY Caption
/stdWrap
captionAlign align /stdWrap Caption alignment default =
".textPos"
94
TypoScript Reference - doc_core_tsref Content Objects (cObject)
95
TypoScript Reference - doc_core_tsref Content Objects (cObject)
Example:
If 6 images are placed in three columns and their width's are high enough
to be forcibly scaled, this value will scale the images in the to be eg. 100,
200 and 300 pixels from left to right
1:2:3
image_compression int /stdWrap Image Compression:
0= Default
1= Don't change! (removes all parameters for the image_object!!)
(adds gif-extension and color-reduction command)
10= GIF/256
11= GIF/128
12= GIF/64
13= GIF/32
14= GIF/16
15= GIF/8
(adds jpg-extension and quality command)
20= IM: -quality 100
21= IM: -quality 90 <=> Photoshop 60 (JPG/Very High)
22= IM: -quality 80 (JPG/High)
23= IM: -quality 70
24= IM: -quality 60 <=> Photoshop 30 (JPG/Medium)
25= IM: -quality 50
26= IM: -quality 40 (JPG/Low)
27= IM: -quality 30 <=> Photoshop 10
28= IM: -quality 20 (JPG/Very Low)
(adds png-extension and color-reduction command)
30= PNG/256
31= PNG/128
32= PNG/64
33= PNG/32
34= PNG/16
35= PNG/8
39= PNG
96
TypoScript Reference - doc_core_tsref Content Objects (cObject)
Example:
1 {
mask = media/uploads/darkroom1_mask.jpg
bgImg = GIFBUILDER
bgImg {
XY = 100,100
backColor = {$bgCol}
}
bottomImg = GIFBUILDER
bottomImg {
XY = 100,100
backColor = black
}
bottomImg_mask = media/uploads/darkroom1_bottom.jpg
}
Example:
tt_content.textpic.default {
5 = IMGTEXT
5 {
text < tt_content.text.default
imgList.field = image
textPos.field = imageorient
imgPath = uploads/pics/
imgObjNum = 1
1 {
file.import.current = 1
file.width.field = imagewidth
imageLinkWrap = 1
imageLinkWrap {
bodyTag = <BODY bgColor=black>
wrap = <A href="javascript:close();"> | </A>
width = 800m
height = 600m
JSwindow = 1
JSwindow.newWindow = 1
JSwindow.expand = 17,20
}
}
maxW = 450
maxWInText = 300
cols.field = imagecols
border.field = imageborder
caption {
1 = TEXT
1.field = imagecaption
1.wrap = <font size="1"> |</font>
1.wrap2 = {$cBodyTextWrap}
}
borderThick = 2
colSpace = 10
rowSpace = 10
textMargin = 10
}
30 = HTML
30.value = <br>
97
TypoScript Reference - doc_core_tsref Content Objects (cObject)
CASE
This provides something alike a switch-construct in PHP. The property "key" is supposed to equal the name of another
property in the object (Array...) which is a cObject. If the property .[key] is defined, "default" will be used.
Strings is Array... can be anything except the reserved words "key", "default", "stdWrap", "if"
Example:
This example chooses between two different renderings of some content depending on whether the field "layout" is "1" of not
("default"). The result is in either case wrapped with "|<BR>". If the field "header" turns out not to be set ("false") an empty
string is returned anyway.
stuff = CASE
stuff.key.field = layout
stuff.if.isTrue.field = header
stuff.stdWrap.wrap = |<BR>
stuff.default = TEXT
stuff.default {
....
}
stuff.1 = TEXT
stuff.1 {
....
}
LOAD_REGISTER:
This provides a way to load the array $GLOBALS["TSFE"]->register[] with values. It doesn't return anything! The usefullness
of this is, that some predefined configurations (like the page-content) can be used in various places but use different values as
the values of the register can change during the page-rendering.
page.27 = LOAD_REGISTER
page.27 {
contentWidth = 500
label.field = header
98
TypoScript Reference - doc_core_tsref Content Objects (cObject)
RESTORE_REGISTER
This unsets the latest changes in the register-array as set by LOAD_REGISTER.
Internally this works like a stack where the original register is saved when LOAD_REGISTER is called. Then a
RESTORE_REGISTER cObject is called the last element is pulled of that stack the register is replaced with it.
RESTORE_REGISTER has no properties.
FORM
This object provides a way to create forms
textarea: Label | [* = required][fieldname =] textarea[,cols,rows,"wrap= [eg. "OFF"]"] | [defaultdata]
| Special evaluation configuration (see note below)
input: Label | [* = required][fieldname =] input[,size,max] | [defaultdata] | Special
evaluation configuration (see note below)
password: Label | [* = required][fieldname =] input[,size,max] | [defaultdata]
file: Label | [* = required][fieldname (*1)=] file[,size]
check: Label | [* = required][fieldname =]check | [checked=1]
select: Label | [* = required][fieldname =]select[,size (int/"auto"), "m"=multiple] | label
[=value] , ...
radio: Label | [* = required][fieldname =]radio | label [=value] , ...
hidden: |[fieldname =]hidden | value
submit: Label |[fieldname =]submit | Caption
reset: Label |[fieldname =]reset | Caption
label: Label | label | Label value
property: [Internal, see below]
------------------
You can enter multiple items to be preselected by placing a asterisk in front of each preselected item.
Property override:
This can be done with the following properties from the table below:
type, locationData, goodMess, badMess, emailMess
syntax:
|[property] =property | value
(*1) (fieldname for files)
In order for files to be attached the mails, you must use the fieldnames:
attachment, attachment1, ... , attachment10
Correct return-email:
In order for the mails to be attached with the email address of the people that submits the mails, please use the fieldname
"email", eg: Email: | *email=input |
Special evaluation
By prefixing a “*” before the fieldname of most types you can have the value of the field required. The check is done in
JavaScript; It will only submit the form if this field is filled in.
Alternatively you can evaluate a field value against a regular expression or as an email address for certain types (textarea,
password, input).
This is done by specifying the “Special evaluation configuration” for those types as part 4 in the configuration line (see
examples above).
The special evaluation types are divided by a semicolon (“:”).
The first part defines the evaluation keyword. Current options are “EREG” (for regular expression) and “EMAIL” (for
evaluation to an email address).
If the “EREG” keyword is specified the 2nd and 3rd parts are error message and regular expression respectively.
99
TypoScript Reference - doc_core_tsref Content Objects (cObject)
Examples:
Your address: | address=textarea,40,10 | | EREG : You can enter only characters A to Z : ^[a-zA-Z]*$
Your email: | *email=input | | EMAIL
Example:
dataArray {
10.label = Name:
10.type = name=input
10.value = [Enter name]
10.required = 1
20.label = Eyecolor
20.type = eyecolor=select
20.valueArray {
10.label = Blue
10.value = 1
20.label = Red
20.value = 2
20.selected = 1
}
40.type = submit=submit
40.value = Submit
}
Why do it this way? Good question, but doing it this way has a
tremendous advantage because labels are all separated from the codes. In
addition it's much easier to pull out or insert new elements in the form.
Inserting an email-field after the name field would be like this:
dataArray {
15.label = Email:
15.type = input
15.value = your@email.com
15.specialEval = EMAIL
}
dataArray {
10.label.lang.dk = Navn:
10.value.lang.dk = [Indtast dit navn]
20.label.lang.dk = Øjenfarve
20.valueArray {
10.label.lang.dk = Blå
20.label.lang.dk = Rød
}
40.value.lang.dk = Send
}
100
TypoScript Reference - doc_core_tsref Content Objects (cObject)
NOTE: If this value is set the target of this overriddes the target of the
"type".
recipient (list of) string Email recipient of the formmail content (generates the hiddenfield No email
/stdWrap "recipient")
goodMess string Message for the formevaluation function in case of correctly filled form. No message
101
TypoScript Reference - doc_core_tsref Content Objects (cObject)
Example:
This substitutes the "###FIELD###" with the field data and the
"###LABEL###' with labeldata.
<tr><td>###FIELD###</td><td> ###LABEL###</td></tr>
You can also use the marker ###COMMENT### which is ALSO the label
value inserted, but wrapped in .commentWrap stdWrap-properties (see
below)
fieldWrap ->stdWrap Field: Wraps the fields
labelWrap ->stdWrap Labels: Wraps the label
commentWrap ->stdWrap Comments: Wrap for comments IF you use ###COMMENT###
REQ boolean Defines if required-fields should be checked and marked up
REQ.fieldWrap ->stdWrap Field: Wraps the fields, but for reuired fields the "fieldWrap"-
property
REQ.labelWrap ->stdWrap Labels: Wraps the label, but for reuired fields the "labelWrap"-
property
REQ.layout string The same as "layout" above, but for reuired fields the "layout"-
property
COMMENT.layout string Alternative layout for comments. the "layout"-
property
CHECK.layout string Alternative layout for checkboxes the "layout"-
property
RADIO.layout string Alternative layout for radiobuttons the "layout"-
property
LABEL.layout string Alternative layout for label types the "layout"-
property
stdWrap ->stdWrap Wraps the hole form (before formtags is added)
hiddenFields [array of cObject] Used to set hiddenFields from TS.
Example:
hiddenFields.pid = TEXT
hiddenFields.pid.value = 2
This makes a hidden-field with the name “pid” and value “2”.
params form-element tag Extra parameters to form elements
parameters
Example:
params = style=”width:200px;”
params.textarea = style=”width:300px;”
params.check =
This sets the default to 200 px width, but excludes check-boxes and sets
textareas to 300.
102
TypoScript Reference - doc_core_tsref Content Objects (cObject)
Example:
If value is tx_myextension[input][ | ] then the fieldname "email" would
be wrapped to this value: tx_myextension[input][email]
noWrapAttr boolean If this value is true then all wrap attributes of textarea elements are
suppressed. This is needed for XHTML-compliancy.
The wrap attributes can also be disabled on a per-field basis by using the
special keyword "disabled" as the value of the wrap attribute.
arrayReturnMode boolean If set, the <form> tags and the form content will be returned in an array
as separate elements including other pratical values. This mode is for use
in extensions where the array return value can be more useful.
accessibility boolean If set, then the form will be compliant with accessibility guidelines (XHTML
compliant). This includes:
<form name=”...”>
fieldPrefix string Alternative prefix for the name of the fields in this form. Otherwise, all
fields are prefixed with the form name (either a unique hash or the name
set in the “formName” property). If set to “0”, there will be no prefix at all.
dontMd5FieldNames boolean The IDs generated for all elements in a form are md5 hashes from the
fieldname. Setting this to true will disable this behaviour and use a cleaned
fieldname, prefixed with the form name as the ID, instead.
This can be useful to style specifically named fields with CSS.
[tsref:(cObject).FORM]
Example: Login
In order to create a login form, you would need to supply these fields:
• "username" = username
• "userident" = password
• "login_status" = "logout" for logout, "login" for login.
If you insert "<!--###USERNAME###-->" somewhere in your document this will be substituted by the username if a user is
logged in!
If you want the login-form to change into a logout form you should use conditions to do this. See this TS-example (extract
from the static_template "styles.content (default)"):
# loginform
styles.content.loginform {
data = Username:|*username=input || Password:|*userident=password
}
[usergroup = *]
styles.content.loginform.data = Username: <!--###USERNAME###--> || |submit=submit| Logout
[global]
Example: Mailform
This creates a simple mail form (this is not TypoScript, but the setup code that you should put directly into the "bodytext"-field
of a pagecontent record of the type "FORMMAIL":
Name: | *replyto_name= input | Enter your name here
Email: | *replyto_email=input |
Like TV: | tv=check |
| formtype_mail = submit | Send this!
| html_enabled=hidden | 1
| subject=hidden| This is the subject
| recipient_copy=hidden | copy@email.com
103
TypoScript Reference - doc_core_tsref Content Objects (cObject)
• "replyto_name": If the field is named like this the value is used as reply to name in the email software and will not be
shown in the mail content. Choose another field name like the_name to use the value as a normal field. Note the
asterisk (*) which means the field is required. and the fieldname will be "the_name". Also a default value is set
("Enter your name here")
• "replyto_email": If the field is named like this the value is used as reply to email address in the email software and
will not be shown in the mail content. To get the value as sender address in the mail software use "email" as field
name.
• "Like TV" is a checkbox. Default is "unchecked".
• "formtype_mail" is the name of the submit button. It must be names so if you use the built-in form mail of TYPO3,
at it will make TYPO3 react automatically on the input and interpret it as form mail input!
• "html_enabled" will let the mail be rendered in nice HTML
• "use_base64" will send the mail encoded as base64 instead of quoted-printable
• "subject": Enter the subject of your mail
• "recipient_copy" : A copy is sent to this mail-address. You may supply more addresses by separating with a comma
(,). The mail sent to recipient_copy is the same, but a separate message from the one sent to the 'recipient' and
furthermore the copy-mail is sent only if the 'recipient' mail is sent.
• "auto_respond_msg": This is a autoresponder message. This is sent if the email of the "submitter" is known (field:
"email"). The value of this is the message broken up in to lines by a slash "/". Each slash is a new line in the email.
The first line is used for the subject.
• "from_name": With this option you can set the mail header from name, which will be shown in the mail software.
• "from_email": With this option you can set the mail header from email, which will be shown in the mail software as
sender address.
• "organisation": With this option you can set the mail header organisation parameter, which won't be shown in the
mail but in the mail header.
• "redirect": With this option you can define a TYPO3 page (page id) or external URL (www.example.com) as redirect
url after submit. If this option isn't set the form will be shown again.
• "priority": With this option you can set the priority of the mail from 1 (not important) to 5 (very important). Default is
3.
• "tv" (again, but hidden). Repeating this field may be smart as the value "tv" is normally NOT submitted with the
value "false" if not checked. Inserting this line will ensure a default value for "tv".
SEARCHRESULT
Search words are loaded into the register in a form ready for linking to pages:
Example:
register:SWORD_PARAMS = '&sword_list[]=word1&sword_list[]=word2 .....'
See typolink for more info!
SEARCHRESULT returns results only from pages with of doktype "Standard" (1), "Advanced" (2) and "Not in menu" (5)
Example:
pages.title:tt_content.bodytext
104
TypoScript Reference - doc_core_tsref Content Objects (cObject)
Example:
This substitutes the following fields:
###RANGELOW###: The low result range, eg. "1"
###RANGEHIGH###: The high result range, eg. "10"
###TOTAL###: The total results
###RESULT###: The result itself
###NEXT###: The next-button
###PREV###: The prev-button
next cObject This cObject will be wrapped by a link to the next searchresult. This is the
code substituting the "###NEXT###"-mark
prev cObject This cObject will be wrapped by a link to the prev searchresult. This is the
code substituting the "###PREV###"-mark
target target target til next/prev links!
range int The number of results at a time! 20
renderObj cObject the cObject to render the searchresults
$cObj->data array is set to the resulting record from the search.
Please note, that in all fields are named [tablename]_[fieldnam]. Thus the
pagetitle is in the field "pages_title".
Apart from this, these fields from the pages-table are also present:
uid
renderWrap wrap
resultObj cObject the cObject prepended in the search results returns rows
noResultObj cObject the cObject used if the search results in no rows.
noOrderBy boolean If this is set, the result is NOT sorted after lastUpdated, tstamp for the
pages-table.
wrap wrap Wrap the whole content...
stdWrap ->stdWrap Wrap the whole content...
addExtUrlsAndShortC boolean If set, then the doktypes 3 and 4 (External URLS and Shortcuts) are added
uts to the doktypes being searched.
However at this point in time, no pages will be select if they do not have at
least one tt_content record on them! That is because the pages and
tt_content (or other) table is joined. So there must at least one occurance
of a tt_content element on a External URL / Shortcut page for them to
show up.
languageField.[2nd string Setting a field name to filter language on. This works like the
table] “languageField” setting in ->select
Example:
languageField.tt_content = sys_language_uid
[tsref:(cObject).SEARCHRESULT]
NOTE: "sword" and "scols" MUST be set in order for the search to be engaged.
var "sword" = search word(s)
var "scols" = search columns separated by ":". Eg: pages.title:pages.keywords:tt_content.bodytext
var "stype" = the starting point of the search: false = current page, L-2 = page before currentPage, L-1 = current page, L0 =
rootlevel, L1 = from first level, L2 = from second level
var $GLOBALS["HTTP_POST_VARS"]["locationData"]: If this is set, the search is done as was it from another page in the
website given by the value of "locationData" here. See the description at the cObject "FORMS".
Only if the page locationData is pointing to, is inside the real rootLine of the site, the search will take this into account.
internal:
var "scount": If this is set this is used as the searchCount - the total rows in the search. This way we don't need to reconstruct
this number!
var "spointer": This points to the start-record in the search.
LATER:
105
TypoScript Reference - doc_core_tsref Content Objects (cObject)
var "alldomains" : boolean: If set the search will proceed into other domains
var "allsites" : boolean: If set the search will proceed into other sites (defined by the "root" setting of an
active template.)
var "depth": The depth
Search syntax
When you search, you can use three operatortypes
• AND: "+", "and" (UK), "og" (DK)
• OR: "or" (UK), "eller" (DK)
• NOT: "-", "not" (UK), "uden" (DK)
Default operator is AND. If you encapsulate words in "" they are searched for as a whole string. The search is case insensitive
and matches parts of words also.
Examples:
1. menu backend - will find pages with both 'menu' and 'backend'.
2. "menu backend" - will find pages with the phrase "menu backend".
3. menu or backend - will find pages with either 'menu' or 'backend'
4. menu or backend not content - will find pages with either 'menu' or 'backend' but not 'content'
The part "... pages.uid IN (2,5,6,20,21,22,29,30,31,3,4,8,9,16,1)... " is a list of pages-uid's to search. This list is based on the
page-ids in the website-branch of the pagetree and confines the search to that branch and not the whole page-table.
1. ... AND ((tt_content.header LIKE '%menu%' OR tt_content.bodytext LIKE '%menu%' OR
tt_content.imagecaption LIKE '%menu%') AND (tt_content.header LIKE '%backend%' OR tt_content.bodytext
LIKE '%backend%' OR tt_content.imagecaption LIKE '%backend%')) GROUP BY pages.uid
2. ... AND ((tt_content.header LIKE '%menu backend%' OR tt_content.bodytext LIKE '%menu backend%' OR
tt_content.imagecaption LIKE '%menu backend%')) GROUP BY pages.uid
3. ... AND ((tt_content.header LIKE '%menu%' OR tt_content.bodytext LIKE '%menu%' OR
tt_content.imagecaption LIKE '%menu%') OR (tt_content.header LIKE '%backend%' OR tt_content.bodytext
LIKE '%backend%' OR tt_content.imagecaption LIKE '%backend%')) GROUP BY pages.uid
4. ... AND ((tt_content.header LIKE '%menu%' OR tt_content.bodytext LIKE '%menu%' OR
tt_content.imagecaption LIKE '%menu%') OR (tt_content.header LIKE '%backend%' OR tt_content.bodytext
LIKE '%backend%' OR tt_content.imagecaption LIKE '%backend%') AND NOT (tt_content.header LIKE
'%content%' OR tt_content.bodytext LIKE '%content%' OR tt_content.imagecaption LIKE '%content%'))
GROUP BY pages.uid
Notice that upper and lowercase does not matter. Also 'menu' as searchword will find 'menu', 'menus', 'menuitems' etc.
106
TypoScript Reference - doc_core_tsref Content Objects (cObject)
how this may be usefull for you. Basically it offers you an API of functions which are more or less relevant for you. Refer to
the “Include PHP scripts” section in this document.
It's a little like the PHP_SCRIPT concept but this is somehow cleaner, because it's a call to a function previously defined and
not an inclusion of a PHP-script file. So this is recommended.
If you create this object as USER_INT, it'll be rendered non-cached, outside the main page-rendering. See the
PHP_SCRIPT_INT for details as this is the same concept used there.
Example:
This TypoScript will display all content element headers of a page in
reversed order. Please take a look in typo3/sysext/cms/tslib/media/scripts/
example_callfunction.php!
page = PAGE
page.typeNum=0
includeLibs.something =
media/scripts/example_callfunction.php
page.30 = USER
page.30 {
userFunc = user_various->listContentRecordsOnPage
reverseOrder = 1
}
NOTE: When using a function, the name of the function has to start with
“user_”. When using a class, the name of the class must start with “user_”
(there are no conditions on the name of the method).
includeLibs list of resource (This property applies only if the object is created as USER_INT)
This is a comma-separated list of resources that are included as PHP-
scripts (with include_once() function) if this script is included.
This is possible to do because any include-files will be known before the
scripts are included. That's not the case with the regular PHP_SCRIPT
cObject.
[tsref:(cObject).USER/(cObject).USER_INT]
107
TypoScript Reference - doc_core_tsref Content Objects (cObject)
PHP_SCRIPT
This includes a PHP-script. You should not name these script ".php" but rather ".inc" as it's meant to be included and not
executed on it's own.
NOTE: This options is ignored if $TYPO3_CONF_VARS["FE"]["noPHPscriptInclude"]=1; is set in localconf.php.
Directions:
1) All content must be put into $content. No output must be echo'ed
out!
PHP_SCRIPT_INT
(see PHP_SCRIPT)
Purpose:
This basically works like PHP_SCRIPT. But the vital difference is that
inserting a PHP_SCRIPT_INT (internal opposed to external, see below)
merely inserts a divider-string in the code and then serializes the current
cObj and puts it in the $GLOBALS["TSFE"]->config[“INTincScript”]-array.
This array is saved with the cached page-content.
Now, the point is, that including a script like this lets you avoid disabling
pagecaching. The reason is that the cached page contains the divider
string and when a “static” page is fetched from cache, it's divided by that
string and the dynamic content object is inserted.
This is the compromise option of all three PHP_SCRIPT-cObjects, because
the page-data is all cached, but still the pagegen.php script is included,
which initializes all the classes, objects and so. What you gain here is an
environment for your script almost exactly the same as PHP_SCRIPT
because your script is called from inside a class tslib_cObj object. You can
work with all functions of the tslib_cObj-class. But still all the “static”
pagecontent is only generated once, cached and only your script is
dynamically rendered.
Rules:
- calls to $GLOBALS["TSFE"]->set_no_cache() and $GLOBALS["TSFE"]-
>set_cache_timeout_default() makes no sense in this situation.
- parsing errors does not interfere with caching
- Be aware that certain global variables may not be set as usual and be
available as usual when working in this mode. Most scripts should work
out-of-the-box with this option though.
- Dependence and use of LOAD_REGISTER is fragile because the
PHP_SCRIPT_INT is not rendered until after the cached content and due to
this changed order of events, use of LOAD_REGISTER may not work.
- You can not nest PHP_SCRIPT_INT and PHP_SCRIPT_EXT in
PHP_SCRIPT_INT. You may nest PHP_SCRIPT cObjects though.
108
TypoScript Reference - doc_core_tsref Content Objects (cObject)
PHP_SCRIPT_EXT
(see PHP_SCRIPT)
Purpose:
This works like PHP_SCRIPT_INT, because a divider string is also inserted
in the content for this kind of include-script. But the difference is that the
content is divided as the very last thing before it's output to the browser.
This basically means that PHP_SCRIPT_EXT (external, because it's
included in the global space in index_ts.php file!!) can output data directly
with echo-statements!
This is a very “raw” version of PHP_SCRIPT because it's not included from
inside an object and you have only very few standard functions from
TYPO3 to call.
This is the fastest option of all three PHP_SCRIPT-cObjects, because the
page-data is all cached and your dynamic content is generated by a raw
php-script
Rules:
- All content can be either 1) echo'ed out directly, or 2) returned in
$content.
- calls to $GLOBALS["TSFE"]->set_no_cache() and $GLOBALS["TSFE"]-
>set_cache_timeout_default() makes no sense in this situation.
- parsing errors does not interfere with caching
- In the global name-space, the array $REC contains the current record
when the file was “inserted” on the page, and $CONF-array contains the
configuration for the script.
- Don't mess with the global vars named $EXTiS_*
includeLibs list of resource This is a comma-separated list of resources that are included as PHP-
scripts (with include_once() function) if this script is included.
This is possible to do because any include-files will be known before the
scripts are included. That's not the case with the regular PHP_SCRIPT
cObject.
[tsref:(cObject).PHP_SCRIPT_EXT]
109
TypoScript Reference - doc_core_tsref Content Objects (cObject)
TEMPLATE
Property: Data type: Description: Default:
template cObject This must be loaded with the template-code. If not the object returns
nothing.
subparts Array... of This is an array of subpart-markers (case-sensitive).
cObject A subpart is defined by two markers in the template. The markers must be
wrapped by "###" on both sides. You may insert the subpart-markers
inside HTML-comment-tags!!
Example:
subparts {
HELLO = TEXT
HELLO.value = En subpart er blevet erstattet!!
}
In the templates:
<!-- start of subpart: ###HELLO### -->
This is the HTML.code, that will be loaded in the
register and replaced with the result...
<!-- end ###HELLO### -->
NOTE:
Before the content-objects of each subpart is generated, all subparts in the
array are extracted and loaded into the register so that you can load them
from there later on.
The register-key for each subparts code is "SUBPART_[theSubpartkey]".
In addition the current-value is loaded with the content of each subpart
just before the cObject for the subpart is parsed. That makes it quite easy
to load the subpart of the cObject (eg: ".current=1")
Eg. this subpart above has the register-key "SUBPART_HELLO".
This is valid ONLY if the property .nonCachedSubst is not set! (see below)
relPathPrefix string / properties Finds all relative references (eg. to images or stylesheets) and prefixes this
value.
If you specify properties (uppercase) these will match HTML tags and
specify alternative paths for them. See example below.
If the property is named "style" it will set alternative path for the "url()"
wrapper that may be in <style> sections.
Example:
page.10 = TEMPLATE
page.10 {
template = FILE
template.file = fileadmin/template.html
relPathPrefix = fileadmin/
relPathPrefix.IMG = fileadmin/img/
}
Inthis example all relative paths found are prefixed "fileadmin/" unless it
was the src attribute of an img tag in which case the path prefixed is
"fileadmin/img/"
marks Array... of This is an array of marks-markers (case-sensitive).
cObject A mark is defined by one markers in the template. The marker must be
wrapped by "###" on both sides. Opposite to subparts, you may NOT
insert the subpart-markers inside HTML-comment-tags! (They will not be
removed).
Marks are substituted bya str_replace-function. The subparts loaded in the
register is available also to the cObjects of markers (only if
.nonCachedSubst is not set!).
wraps Array... of This is an array of wraps-markers (case-sensitive).
cObject This is shown best by an example:
Example:
wraps {
MYLINK = TEXT
MYLINK.value = <A href=”#”> | </A>
}
In the template:
This is <!--###MYLINK###-->a link to my<!--
###MYLINK###--> page!
In this example the MYLINK subpart will be substituted by the wrap which
is the content returned by the MYLINK cObject.
110
TypoScript Reference - doc_core_tsref Content Objects (cObject)
Example:
page.10 = TEMPLATE
page.10 {
template = FILE
template.file = fileadmin/test.tmpl
subparts {
HELLO = TEXT
HELLO.value = This is the replaced subpart-code
}
marks {
Testmark = TEXT
Testmark.value = This is replacing a simple marker in the HTML-code
}
workOnSubpart = DOCUMENT
}
111
TypoScript Reference - doc_core_tsref Content Objects (cObject)
MULTIMEDIA
Property: Data type: Description: Default:
file resource /stdWrap The multimedia file. Types are:
txt, html, htm: Inserted directly
class: Java-applet
swf: Flash animation
swa, dcr: ShockWave Animation
wav,au: Sound
avi,mov,asf,mpg,wmv: Movies (AVI, QuickTime, MPEG4)
params string /stdWrap This is parameters for the multimedia-objects. Use this to enter stuff like
with and height:
Example:
width=200
height=300
au, wav:
width of control (default 200)
height of control (default 16)
loop = true / false
autostart = true/false
avi,mov,asf,mpg,wmv:
width of control (default 200)
height of control (default 200)
autostart = true/false (not "mov", see below for example)
swf,swa,dcr:
width (browserdefault approx. 200)
height (browserdefault approx. 200)
quality (default "high")
class:
width (default 200)
height (default 200)
112
TypoScript Reference - doc_core_tsref Content Objects (cObject)
EDITPANEL
This content object is inserted only if a backend user is logged in and if that user has enabled “Display Edit Icons” in the front
end Admin Panel. If the edit panel is inserted, page caching is disabled as the edit panel offers editing feature only available
for backend users.
The edit panel inserts icons for moving, editing, deleting, hiding and creating records.
Example:
Section: <B>%s</B>
allow string Define which functions are accessible. Further this list may be reduced, if
the BE_USER does not have permission to perform the action
Values should be listed separated by comma. This is the options you can
choose between:
toolbar,edit,new,delete,move,hide
(toolbar is a general list of icons regarding the page, so use this for
pagerecords only)
newRecordFromTable string Will display a panel for creation of new element (in the top of list) on the
page from that table.
newRecordInPid int Define a page ID where new records (except new pages) will be created.
line boolean / int If set, a black line will appear after the panel. This value will indicate the
distance from the black line to the panel
edit.displayRecord boolean If set, then the record edited is displayed above the editing form.
onlyCurrentPid boolean If set, only records with a pid matching the current id (TSFE->id) will be
shown with the panel.
innerWrap wrap Wraps the edit panel
outerWrap wrap Wraps the whole edit panel including the black line (if configured)
previewBorder boolean / int If set, the hidden/starttime/endtime/fe_user elements which are previewed
will have a border around.
The integer value denotes the thickness of the border
previewBorder.inner wrap / HTML color innerWrap wraps the content elements (including the icons) inside the
Wrap preview border (an HTML table).
previewBorder.outer
Wrap outerWrap wraps the whole content element including the border.
previewBorder.color
color denotes the color of the border.
[tsref:(cObject).EDITPANEL]
113
TypoScript Reference - doc_core_tsref GIFBUILDER
GIFBUILDER
GIFBUILDER
GIFBUILDER is a object, which is used in many situations for creating gif-files. Anywhere the ->GIFBUILDER object is
mentioned, this is the properties that apply.
NOTE (+calc)
When ever the "+calc"-function is added to a value in the data type of the properties underneath, you can use the dimensions
of TEXT and IMAGE-objects from the GifBuilderObj-array. This is done by inserting a tag like this: "[10.w]" or "[10.h]", where
"10" is the GifBuilderObj-number in the array and "w"/"h" signifies either width or height of the object.
The special property "lineHeight" (e.g. "[10.lineHeight]") uses the the height a single line of text would take.
On using the special function max(), the maximum of multiple values can be determined. Example:
XY: [10.w]+[20.w], max([10.h], [20.h])
As you see, the gif-image has a width defined as the width of the text printed onto it + 10 pixels. The height is fixed by the
value of the constant {$styles.header.gfx1.itemH}
114
TypoScript Reference - doc_core_tsref GIFBUILDER
The key:
The value of the array key will be the key used when forcing the
configuration into “splitRendering” configuration of the individual
GIFBUILDER objects. In the example below the key is “123”.
Notice; If the key is already found in the local GIFBUILDER
configuration the content of that key is respected and not
overridden. Thus you can make local configurations which override
the global setting.
Example:
_GIFBUILDER.charRangeMap {
123 = arial.ttf
....
[array].charMapConfig TEXT / splitRendering configuration to set. See GIFBUILDER TEXT object
splitRendering. for details.
[array]
configuration Example:
_GIFBUILDER.charRangeMap {
123 = arial.ttf
123 {
charMapConfig {
fontFile = t3lib/fonts/vera.ttf
value = -65
fontSize = 45
}
fontSizeMultiplicator = 2.3
}
}
115
TypoScript Reference - doc_core_tsref GIFBUILDER
Example:
_GIFBUILDER.charRangeMap {
123 = arial.ttf
123 {
charMapConfig {
fontFile = t3lib/fonts/vera.ttf
value = 48-57
color = green
xSpaceBefore = 3
xSpaceAfter = 3
}
pixelSpaceFontSizeRef = 24
}
}
Option:
transparentColor.closest = 1
This will allow for the closest color to be matched instead. You may need
this if you image is not garanteed "clean".
NOTE: You may experience that this doesn't work if you use
reduceColors-option or render text with niceText-option.
quality posint (10-100) JPG-quality (if “.format” = jpg/jpeg)
backColor GraphicColor Background color for the gif white
/stdWrap
offset x,y +calc Offset all objects on the gif. 0,0
116
TypoScript Reference - doc_core_tsref GIFBUILDER
TEXT
Property: Data type: Description: Default:
text stdWrap This is text text-string on the gif-file. The item is rendered only if this
string is not empty.
The cObj->data-array is loaded with the page-record, if for example the
GIFBUILDER-object is used by GMENU or IMGMENU
breakWidth integer Defines the maximum width for an object, overlapping elements will force
an automatic line break.
breakSpace float Defines a value that is multiplied by the line height of the current element. 1.0
textMaxLength int The maximum length of the text. This is just a natural break that 100
prevents incidental rendering of very long texts!
maxWidth pixels Sets the maximum width in pixels, the text must be. Reduces the fontSize
if the text does not fit within this width.
117
TypoScript Reference - doc_core_tsref GIFBUILDER
->stdWrap
properties for
"altText" and
"titleText" in this
case
niceText boolean This is a very popular feature that helps to render small letters much nicer
than the freetype library can normally do. But it also loads the system very
much!
The principle of this function is to create a black/white giffile in twice or
more times the size of the actual gif-file and then print the text onto this is
a scaled dimension. Afterwards ImageMagick (IM) scales down the mask
and masks the font color down on the original gif-file through the
temporary mask.
The fact that the font is actually rendered in the double size and scaled
down adds a more homogenous shape to the lettes. Some fonts are more
critical than others though. If you do not need the quality, then don't use
the function.
Some properties:
.before = IM-params before scale
.after = IM-params after scale
.sharpen = sharpen-value for the mask (after scaling), integer 0-99 (this
enables you to make the text crisper if it's too blurred!)
.scaleFactor = scaling-factor, int 2-5
118
TypoScript Reference - doc_core_tsref GIFBUILDER
Properties:
splitRendering.compX = Additional pixelspace between parts, x direction
splitRendering.compY = Additional pixelspace between parts, y direction
splitRendering.[array] = keyword [charRange, highlightWord]
splitRendering.[array] {
fontFile = Alternative font file for this rendering
fontSize = Alternative font size for this rendering
color = Alternative color for this rendering, works ONLY without
“niceText”
xSpaceBefore = x-Space before this part
xSpaceAfter = x-Space after this part
ySpaceBefore = y-Space before this part
ySpaceAfter = y-Space after this part
}
Keyword: charRange
splitRendering.[array].value = Commaseparated list of character ranges
(eg. “100-200”) given as Unicode character numbers. The list accepts
optional starting and ending points, eg. “ - 200” or “ 200 -” and single
values, eg. “65, 66, 67”
Keyword: highlightWord
splitRendering.[array].value = Word to highlight, makes a case sensitive
search for this.
Limitations:
● The pixelcompensation values are not corrected for scale factor used
with niceText. Basically this means that when niceText is used, these
values will have only the half effect.
● When word spacing is used the “highlightWord” mode doesn't work.
● The color override works only without “niceText”.
Example:
10.splitRendering.compX = 2
10.splitRendering.compY = -2
10.splitRendering.10 = charRange
10.splitRendering.10 {
value = 200-380 , 65, 66
fontSize = 50
fontFile = t3lib/fonts/nimbus.ttf
xSpaceBefore = 30
}
10.splitRendering.20 = highlightWord
10.splitRendering.20 {
value = TheWord
color = red
}
[tsref:->GIFBUILDER.(GBObj).TEXT]
119
TypoScript Reference - doc_core_tsref GIFBUILDER
SHADOW
Property: Data type: Description: Default:
textObjNum pos-int Must point to the TEXT-object if these shadow-properties are not
properties to a TEXT-object directly ("stand-alone-shadow"). Then the
shadow needs to know which TEXT-object it should be a shadow of!
If - on the other hand - the shadow is a property to a text-object, this
property is not needed.
offset x,y Shadow offset
color GraphicColor Shadow color
blur posint (1-99) Blurring of the shadow. Above 40 only values of 40,50,60,70,80,90
means something.
EMBOSS
Emboss is actually two shadows offset in opposite directions and with different colors as to create an effect of light casted
onto an embossed text.
OUTLINE
This outline normally renderes quite ugly as it's done by print 4 or 8 texts underneath the text in question. Try to use a
shadow with a high intensity. That works better!
120
TypoScript Reference - doc_core_tsref GIFBUILDER
BOX
Property: Data type: Description: Default:
dimensions x,y,w,h +calc Dimensions of a filled box.
x,y is the offset.
w,h is the dimensions. Dimensions of 1 will result in 1-pixel wide lines!
color GraphicColor fill-color black
opacity pos-int (1-100) Opacity (i.e. inverse of transparency, e.g. 100% opacity = 0% 100
transparency)
align VHalign
[tsref:->GIFBUILDER.(GBObj).BOX]
IMAGE
Property: Data type: Description: Default:
file imgResource The imagefile
offset x,y +calc Offset 0,0
tile x,y tile x,y times.
Maximum times is 20 each direction. If you need more, use a larger
image.
align VHalign
mask imgResource Optional mask-image for the imagefile.
[tsref:->GIFBUILDER.(GBObj).IMAGE]
EFFECT
.value = [Varnavn] = [value] | [Varnavn] = [value]
Example:
20 = EFFECT
20.value = gamma=1.3 | flip | rotate=180
121
TypoScript Reference - doc_core_tsref GIFBUILDER
WORKAREA
Sets another workarea
CROP
NOTE: This object resets workArea to the new dimensiosn of the image!
SCALE
NOTE: This object resets workArea to the new dimensiosn of the image!
ADJUST
This lets you adjust the input-levels like in Photoshops "levels"-dialog. If you need to adjust gamma, look at the EFFECT-
object.
Example:
20 = ADJUST
20.value = inputLevels = 13,230
122
TypoScript Reference - doc_core_tsref GIFBUILDER
NON-GifBuilderObj
IMGMAP
This is used by the GifBuilderObj "TEXT" to create a image-map for the gif-file. This is especially used with the IMGMENU
menuobject.
123
TypoScript Reference - doc_core_tsref MENU Objects
MENU Objects
Common properties
These properties are in common for all menu objects if not otherways stated!
LIMITATIONS:
This property works with normal menus, sectionsIndex menus and
special-menus of type "directory".
minItems int The minimum items in the menu. If the number of pages does not reach
this level, a dummy-page with the title "..." and uid=[currentpage_id] is
inserted.
Example:
This results in a menu, where the first two items are skipped starting with
item number 3:
begin = 3
.newWindow boolean, that lets every menuitem open in its own window
opposite to opening in the same window for each click.
NOTE: Don't set this if you're working with a menu with sectionIndex! In
that case you need special unique names of items based on something
else than the uid of the parent page of course!
debugItemConf Outputs (by the debug()-function) the configuration arrays for each
menuitem. Useful to debug optionSplit things and such...
Applies to GMENU, TMENU, IMGMENU
overrideId integer (page-id) If set, then all links in the menu will point to this pageid. Instead the real
uid of the page is sent by the parameter "&real_uid=[uid]".
This feature is smart, if you have inserted a menu from somewhere else,
perhaps a shared menu, but wants the menuitems to call the same page,
which then generates a proper output based on the real_uid.
Applies to GMENU, TMENU, IMGMENU
124
TypoScript Reference - doc_core_tsref MENU Objects
Example:
"&some_var=some%20value"
Must be rawurlencoded.
Applies to GMENU, TMENU, IMGMENU
showAccessRestricted integer (page id) / If set, pages in the menu will include pages with frontend user group
Pages keyword “NONE” access enabled. However the page is of course not accessible and
therefore the URL in the menu will be linked to the page with the ID of
this value. On that page you could put a login form or other message.
If the value is “NONE” the link will not be changed and the site will
perform page-not-found handling when clicked (which can be used to
capture the event and act accordingly of course).
Properties:
.addParam = Additional parameter for the URL, which can hold two
markers; ###RETURN_URL### which will be substituted with the link
the page would have had if it had been accessible and ###PAGE_ID###
holding the page id of the page coming from (could be used to look up
which fe_groups was required for access.
Example:
showAccessRestrictedPages = 22
showAccessRestrictedPages.addParams =
&return_url=###RETURN_URL###&pageId=###PAGE_ID###
The example will link access restricted menu items to page id 22 with the
return URL in the GET var “return_url” and the page id in the GET var
“pageId”.
itemArrayProcFunc function-name The first variable passed to this function is the “menuArr” array with the
menuitems as they are collected based on the type of menu.
You're free to manipulate or add to this array as you like. Just remember
to return the array again!
Note:
.parentObj property is hardcoded to be a reference to the calling
tslib_menu object. Here you'll find eg. ->id to be the uid of the menu item
generating a submenu and such.
125
TypoScript Reference - doc_core_tsref MENU Objects
Example:
This example will generate a menu where the menu objects for the
second level will differ depending on the number of the first level item for
which the submenu is rendered. The second level objects used are “2”
(the default), “2a” and “2b” (the alternatives). Which of them is used is
defined by “1.submenuObjSuffixes” which has the configuration “a |*| |*|
b”. This configuration means that the first menu element will use
configuration “2a” and the last will use “2b” while anything in between will
use “2” (no suffix applied)
page.200 = HMENU
page.200 {
1 = TMENU
1.wrap = <div style="width:200px; border: 1px
solid;">|</div>
1.expAll = 1
1.submenuObjSuffixes = a |*| |*| b
1.NO.allWrap = <b>|</b><br/>
2 = TMENU
2.NO.allWrap = <div style="background:red;">|</div>
2a = TMENU
2a.NO.allWrap = <div style="background:yellow;">|
</div>
2b = TMENU
2b.NO.allWrap = <div style="background:green;">|
</div>
}
The result can be seen in the image below (applied on the testsite
package):
126
TypoScript Reference - doc_core_tsref MENU Objects
page.20 = HMENU
page.20.1 = TMENU
page.20.1.NO = 1
Order of priority: USERDEF2, USERDEF1, SPC, USR, CURIFSUB, CUR, ACTIFSUB, ACT, IFSUB
All *RO states requires the default “RO” configuration to be set up.
[menuObj].sectionIndex
This is a property that all menuObj's share. If it's set, then the menu will not consist of links to pages on the "next level" but
rather links to the parent page to the menu, but in addition "#"-links to the cObjects rendered on the page. In other words,
the menuitems will be links to the content elements (with colPos=0!) on the page. A section index.
.sectionIndex = [boolean]
If you set this, all content elements (from tt_content table) of "Column" = "Normal" and the "Index"-check box clicked are
selected. This corresponds to the "Menu/Sitemap" content element when "Section index" is selected as type.
.sectionIndex.type = "all" / "header"
If you set this additional property to "all", then the "Index"-checkbox is not considered and all content elements with colPos=0
is selected.
If this property is "header" then only content elements with a visible header-layout (and a non-empty 'header'-field!) is
selected. In other words, if the header layout of an element is set to "Hidden" then the page will not appear in the menu.
127
TypoScript Reference - doc_core_tsref MENU Objects
NOTE:
You cannot create submenus to sectionIndex-menus. That doesn't make any sense as these elements are not pages and
thereby have no children.
GMENU
GMENU works as a object under the cObject "HMENU" and it creates graphical navigation, where each link is a separate gif-
file
128
TypoScript Reference - doc_core_tsref MENU Objects
Example:
2 = TMENU
2 {
stdWrap.dataWrap = <ul class=”{register :
parentProperty}”> | </ul>
NO {
...
}
}
wrapItemAndSub Wrap /stdWrap Wraps the whole item and any submenu concatenated to it.
wrap wrap Wraps only if there were items in the menu!
applyTotalH objNumsList (offset) This adds the total height of the previously generated menuitems to the
offset of the GifBuilderObj's mentioned in this list.
Example:
This is useful it you want to create a menu with individual items but a
common background image that extends to the whole area behind the
menu. Then you should setup the background image in each
GIFBUILDER-object and include the object-number in this list.
Look at the implementation in static_template "styles.gmenu.bug"
applyTotalW objNumsList (offset) This adds the total width of the previously generated menuitems to the
offset of the GifBuilderObj's mentioned in this list.
min x,y (calcInt) Forces the menu as a whole to these minimum dimensions
max x,y (calcInt) Forces the menu as a whole to these maximum dimensions
useLargestItemX boolean If set, then the width of all menuitems will be equal to the largest of them
all.
useLargestItemY boolean If set, then the height of all menuitems will be equal to the largest of
them all.
distributeX int+ If set, the total width of all the menuitems will be equal to this number of
pixels by adding/subtracting an equal amount of pixels to each menu
items width.
Will overrule any setting for ".useLargestItemX"
distributeY int+ If set, the total height of all the menuitems will be equal to this number of
pixels by adding/subtracting an equal amount of pixels to each menu
items height.
Will overrule any setting for ".useLargestItemY"
removeObjectsOfDum objNumsList If the menu is forced to a certain minimum dimension, this is a list of
my objects in the gifbuilder-object that is removed for this last item. This is
important to do if the menuitems has elements that should only be applied
if the item is actually a menuitem!!
disableAltText boolean If set, the alt-parameter of the images are not set. You can do it manually
by “imgParams” (see below)
IProcFunc function-name The internal array “I” is passed to this function and expected returned as
well. Subsequent to this function call the menu item is compiled by
implode()'ing the array $I[parts] in the passed array. Thus you may
modify this if you need to.
See example on the testsite and in
media/scripts/example_itemArrayProcFunc.php
[Common Item ->GIFBUILDER This is the GIFBUILDER-options for each category of menuitem that can
States, see above] + Additional be generated.
+ rollover version for properties! See
all, except SPC table below NOTE: For the GMENU series you can also define the RollOver
configuration for the item states. This means that you define the
GIFBUILDER object for the 'Active' state by ACT and the RollOver
GIFBUILDER object for the 'Active' state by ACTRO.
This pattern goes for ALL the states except the SPC state.
SPECIAL:
The ->OptionSplit function is run on the whole GIFBUILDER-configuration
before the items are generated.
[tsref:(cObject).HMENU.(mObj).GMENU]
129
TypoScript Reference - doc_core_tsref MENU Objects
GMENU_LAYERS / TMENU_LAYERS
GMENU_LAYERS / TMENU_LAYERS works as an extension to GMENU/TMENU, which means the these properties underneath
is additional properties to the ones above.
The purpose of xMENU_LAYERS is to create 2-level (or more!) menus where the 2nd+ level is shown on a DHTML-layer. Most
features works with modern browsers including Netscape, Microsoft Internet Explorer, Mozilla, Konqueror and Opera. You can
cascade the menus as you like.
NOTE: You must include the library "typo3/sysext/cms/tslib/media/scripts/gmenu_layers.php" (for GMENU_LAYERS) and/or
“typo3/sysext/cms/tslib/media/scripts/tmenu_layers.php” (for TMENU_LAYERS) and you must also expand the
xMENU_LAYERS to the next for the menu to make sense (use the expAll-flag).
Compatibilty: MSIE 4+, Netscape 4+ and 6+, Opera 5+, Konqueror.
Notes:
• Netscape 4 does not support mouseover on the layers.
• Opera seems to have problems with the mouseout event if you roll from an element to a layer. Then the event may not be
fired before entering the layer. It happens only if the layer is placed very close to the trigger element. Problems from this
may be that the rollover state of the items are not reset.
• Possible bug; It has been seen with cascaded layers that Opera may suddently refuse any interaction on the page, even
clicking normal links. It may be a JavaScript error that makes this happen, but as even normalt links are not clickable
anymore, I'm not really sure. Seems to be no problem with single-level menu.
Example:
position:absolute; VISIBILITY: hidden;
lockPosition "x" / "y" / "" If this is set to "x" or "y" the menu on the layers is locked and
does not follow the mouse-cursor (which it does if this is not set).
"x" or "y" defines respectively that the summed width (x) or height
(y) is added to the x or y offset of the menu. That means that you
should set this value to "x" if you have a horizontal
GMENU_LAYERS and to "y" if you have a verical menu.
130
TypoScript Reference - doc_core_tsref MENU Objects
131
TypoScript Reference - doc_core_tsref MENU Objects
Properties:
.onlyOnLoad (boolean)
If set, then the display of the active item will happen only when
the page is loaded. The display will not be restored on mouseout
of other items.
Properties:
.alwaysKeep (boolean)
If set, the freezed element will always stay, even if the submenu is
hidden.
hideMenuWhenNotOver int+ If set (> 1) then the menu will hide it self whenever a user moves
the cursor away from the menu. The value of this parameter
determines the width (pixels) of the zone around the element until
the mousepointer is considered to be far enough away to hide the
layer.
hideMenuTimer int+ This is the number of milliseconds to wait before the submenu will
disappear if hideMenuWhenNotOver is set
dontHideOnMouseUp boolean If set, the menu will not hide it's layers when the mouse botton is
clicked. Usefull if your menuitems loads the pages in another
frame
layer_menu_id string If you want to specifically name a menu on a page. Probably you [random 6 char
don't need that! hashstring]
Additional Properties:
.addWidth = Adds the width of the trigger element
.addHeight = Adds the height of the trigger element
132
TypoScript Reference - doc_core_tsref MENU Objects
Additional Properties:
.addWidth = Adds the width of the parent layer
.addHeight = Adds the height of the parent layer
[tsref:(cObject).HMENU.(mObj).GMENU_LAYERS, (cObject).HMENU.(mObj).TMENU_LAYERS]
Example:
page.includeLibs.gmenu_layers = media/scripts/gmenu_layers.php
page.10 = HMENU
page.10.1 = GMENU_LAYERS
page.10.1 {
layerStyle = position:absolute;VISIBILITY:hidden;
xPosOffset = -30
lockPosition = x
expAll=1
leftOffset = 15
topOffset = 30
}
page.10.1.NO {
backColor = #cccccc
XY = [10.w]+10, 14
10 = TEXT
10.text.field = title
10.offset = 5,10
}
page.10.2 = GMENU
page.10.2.wrap = <nobr>|</nobr>
page.10.2.NO {
backColor = #99cccc
XY = [10.w]+10, 14
10 = TEXT
10.text.field = title
10.offset = 5,10
}
(Please refer to the “testsite” application which has a large section with test-examples for a LOT of applications/configurations
of the xMENU_LAYERS!)
133
TypoScript Reference - doc_core_tsref MENU Objects
GMENU_FOLDOUT
GMENU_FOLDOUT works as an extension to GMENU, which means the these properties underneath is additional properties to
the ones above.
The purpose of GMENU_FOLDOUT is to create 2-level menus which are folded out dynamically.
It works with both Netscape, Mozilla, Microsoft internet Explorer and Opera. The menu on the first level is a GMENU because
GMENU_FOLDOUT is responsible for this, but the submenu on the next level (refered to as 2nd level) can be both TMENU and
another GMENU.
NOTE: You must include the library "media/scripts/gmenu_foldout.php".
The script implemented is taken from http://www9.ewebcity.com/skripts/foldoutmenu_move.htm
Compatibilty: MSIE 4+, Netscape 4+ and 6+, Opera 5+
Example:
-10
This value will substract 10 pixels from the height of the layer in
calculations.
adjustSubItemsH int Adjusts the height calculation of the menulayers of the second level
(subitems, called Sub)
See above
arrowNO imgResource If both arrowNO and arrowACT is defined and valid imgResources then
arrowACT these images are use as “traditional arrows” that indicates whether an
item is expanded (active) or not.
NO is normal, ACT is expanded
The image is inserted just before the menuitem. If you want to change
the position, put the marker ###ARROW_IMAGE### into the wrap of
the item and the image will be put there instead.
134
TypoScript Reference - doc_core_tsref MENU Objects
Example:
hspace=5 vspace=7
displayActiveOnLoad boolean If set, then the active menu items will fold out “onLoad”
[tsref:(cObject).HMENU.(mObj).GMENU_FOLDOUT]
Example:
## GMENU_FOLDOUT
includeLibs.gmenu_foldout = media/scripts/gmenu_foldout.php
temp.foldoutMenu = HMENU
temp.foldoutMenu.1 = GMENU_FOLDOUT
temp.foldoutMenu.1.expAll=1
temp.foldoutMenu.1.NO {
wrap = | <BR>
XY = 150,20
backColor = silver
10 = TEXT
10.text.field = title
10.fontSize = 12
10.fontColor = Blue
10.offset = 2,10
}
temp.foldoutMenu.1.RO < temp.foldoutMenu.1.NO
temp.foldoutMenu.1.RO = 1
temp.foldoutMenu.1.RO {
10.fontColor = red
}
temp.foldoutMenu.2 = TMENU
temp.foldoutMenu.2.NO {
linkWrap = <nobr><font face=verdana size=1 color=black><B>|</B></font></nobr><BR>
stdWrap.case = upper
}
temp.foldoutMenu.1 {
dontLinkIfSubmenu = 1
stayFolded=1
foldSpeed = 6
subMenuOffset = 10,18
menuOffset = 100,20
menuBackColor = silver
bottomBackColor = silver
menuWidth = 170
arrowNO = media/bullets/arrow_no.gif
arrowACT = media/bullets/arrow_act.gif
arrowImgParams = hspace=4 align=top
bottomContent = TEXT
bottomContent.value = Hello World! Here is some content!
}
This creates a menu like this (above). One important point is the line
135
TypoScript Reference - doc_core_tsref MENU Objects
temp.foldoutMenu.1.expAll=1
If you don't set this (just like the GMENU_LAYERS) then the second level is not generated!
TMENU
Property: Data type: Description: Default:
expAll Boolean /stdWrap If this is true, the menu will always show the menu on the level
underneath the menuitem. This corresponds to a situation where a user
has clicked a menuitem and the menu folds out the next level. This can
enable that to happen on all items as default.
collapse boolean If set, "active" menuitems that has expanded the next level on the menu
will now collapse that menu again.
accessKey boolean If set access-keys are set on the menu-links
noBlur boolean Normally links are "blurred" if the browser is MSIE. Blurring removes the
ugly box around a clicked link.
If this property is set, the link is NOT blurred (browser-default) with
"onFocus".
target target Target of the menulinks self
forceTypeValue int If set, the &type parameter of the link is forced to this value regardless of
target.
stdWrap ->stdWrap Wraps the whole item using stdWrap
SPECIAL:
The ->OptionSplit function is run on the whole GIFBUILDER-configuration
before the items are generated.
[tsref:(cObject).HMENU.(mObj).TMENU]
TMENUITEM
The current record is the page-record of the menu item - just like you have it with GMENU/gifbuilder. Now, if you would like
to get data from the current page record, use stdWrap.data = page : [fieldname]
136
TypoScript Reference - doc_core_tsref MENU Objects
Syntax:
[over-color] | [out-color] | [id-prefix]
Example:
page = PAGE
page.typeNum = 0
page.10 = HMENU
page.10.wrap = <table border=1>|</table>
page.10.1 = TMENU
page.10.1.NO {
allWrap = <tr><td valign=top id="1tmenu{elementUid}"
style="background:#eeeeee;">|</td></tr>
subst_elementUid = 1
RO_chBgColor = #cccccc | #eeeeee | 1tmenu
RO = 1
}
This example will start out with the table cells in #eeeeee and change
them to #cccccc (and back) when rolled over. The “1tmenu” string is a
unique id for the menu items. You may not need it (unless the same menu
items are more than once on a page), but the important thing is that the
id of the table cell has the exact same label before the {elementUid} (red
marks). The other important thing is that you DO set a default
background color for the cell with the style-attribute (blue marking). If you
do not, Mozilla browsers will behave a little strange by not capturing the
mouseout event the first time it's triggered.
before HTML /stdWrap
beforeImg imgResource
beforeImgTagParams <img>-params
beforeImgLink boolean If set, this image is linked with the same <A> tag as the text
beforeROImg imgResource If set, ".beforeImg" and ".beforeROImg" is expected to create a rollOver-
pair.
beforeWrap wrap wrap around the ".before"-code
linkWrap wrap
stdWrap ->stdWrap stdWrap to the link-text!
ATagBeforeWrap boolean
ATagParams <A>-params Additional parameters
/stdWrap
Example:
class=”board”
ATagTitle string /stdWrap Allows you to specify the "title" attribute of the <a> tag around the menu
item.
Example:
ATagTitle.field = abstract // description
This would use the abstract or description field for the <a title="">
attribute.
additionalParams string /stdWrap Define parameters that are added to the end of the URL. This must be
code ready to insert after the last parameter.
137
TypoScript Reference - doc_core_tsref MENU Objects
IMGMENU
Background:
Imagemaps are made by creating one large GIFBUILDER-object based on the GIFBUILDER-object ".main" and adding the
properties of the GIFBUILDER-objects for each item (NO, ACT, SPC... and so on).
SPECIAL:
The ->OptionSplit function is run on the whole GIFBUILDER-configuration
before the items are generated.
138
TypoScript Reference - doc_core_tsref MENU Objects
IMGMENUITEM
Property: Data type: Description: Default:
1,2,3,4... ->GifBuilderObj NOTE:
The way a imagemap is made is this; All IMGMENUITEMS are included in
one big Gifbuilderobj (and renumbered!!). Because of this,
Gifbuilderobjects on the next level will not be able to access the data of
each menuitem.
Also the feature of using [##.w] and [##.h] with +calc is currently not
supported by IMGMENUITEMs.
Therefore all IMAGE-objects on the first level is checked; if "file" or
"mask" for any IMAGE-objects are set to "GIFBUILDER", the Gifbuilder-
object is parsed to see if any TEXT-objects are present and if so, the
TEXT-object is "checked" - which means, that the stdWrap-function is
called at a time where the $cObj->data-array is set to the actual
menuitem.
In the example below, the text of each menuitem is rendered by letting
the title be rendered on a mask instead of directly on the image. Please
observe that the "NO.10"-object is present in order for the image-map
coordinates to be generated!!
NO.6 = IMAGE
NO.6.file = masked_pencolor*.gif
NO.6.mask = GIFBUILDER
NO.6.mask {
XY = 500, 200
backColor = black
10 = TEXT
10 {
text.field = title
fontFile = fileadmin/fonts/caflisch.ttf
fontSize = 34
fontColor = white
angle = 15
offset = 48,110
}
20 = EFFECT
20.value = blur=80
}
NO.10 = TEXT
NO.10 {
text.field = title
fontFile = fileadmin/fonts/caflisch.ttf
fontSize = 34
angle = 15
offset = 48,110
hideButCreateMap = 1
}
[tsref:(cObject).HMENU.(mObj).IMGMENUITEM]
JSMENU
Property: Data type: Description: Default:
levels int, 1-5 How many levels there are 1
menuName string JavaScript menu name.
If you have more than one JSMENU on the page, you should set this value
for each one.
target target Decides target of the menu-links
forceTypeValue int If set, the &type parameter of the link is forced to this value regardless of
target.
1,2,3,4... JSMENUITEM levels-config
wrap wrap wrap around the selector-boxes
wrapAfterTags wrap wrap around the selector-boxes with wrap and form-tags og JS-code.
firstLabelGeneral string General firstlabel. May be overridden by the one set in each JSMENUITEM
SPC boolean If set, spacer can go into the menu, else not.
[tsref:(cObject).HMENU.(mObj).JSMENU]
139
TypoScript Reference - doc_core_tsref MENU Objects
JSMENUITEM
Property: Data type: Description: Default:
noLink boolean Normally the selection of a menu item in the selector box will update the
selector on the next level (if there is a next level) and if there are no items
for that selector (because there were no subpages), then the link jumps to
the page of itself.
If this flag is set, however, no menuitems in the selector box will ever link
to anything. Only update the content of the next selector box on next
level.
alwaysLink boolean If set an item in the menu selector will always link. This takes precedence
over "noLink".
showFi rst boolean if set, the first link will be shown when the menu is updated.
showActive boolean if set, the active level will be selected, if present
wrap wrap wraps the selectorbox
width int+ Initial width of the boxes set by a number of _ (underscores) 14
elements int+ Initial number of elements in the menu. This is of course overruled by the 5
actual menu item texts.
additionalParams string Additional parameters to the <select> box. Eg, you could set the width
with a style-parameter like this:
style="width: 200px;"
firstLabel string Firt label in top of the menu (default is blank)
[tsref:(cObject).HMENU.(mObj).JSMENUITEM]
Example:
# The menu:
temp.jsmenu = HMENU
temp.jsmenu.1 = JSMENU
temp.jsmenu.1 {
levels = 2
1.wrap = |<BR>
2.wrap = |<HR>
}
# Insert on page.
page = PAGE
page.typeNum =0
page.5 = TEXT
page.5.field = title
page.10 < temp.jsmenu
140
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
media/scripts/ Plugins
media/scripts/ in general
This directory primarily contains php-scripts which are meant as 'external modules' as opposed to features included in the
typo3/sysext/cms/tslib/ libraries. Although they are distributed with TYPO3 just like tslib/ they form a basis for externally
developed front-end functionality. So for most of these scripts, be inspired by them to write your own code. Notice the word
'most'; because some are written long time ago and does not represent the state-of-the-day to do it.
fe_adminLib.inc
Files:
File: Description:
fe_adminLib.inc Main class used to display the fe administration forms
Call it from a USER_INT cObject with 'userFunc = user_feAdmin->init'. See the static_templates for
examples.
Note: Using the USER_INT cObject allows the script to work regardless of the page-cache which is
necessary!!
fe_admin_dmailsubscrip.tmpl Example template file for subscription to newsletters of users to the tt_address table. This template is
used by the static_template 'plugin.feadmin.dmailsubscription'
fe_admin_fe_users.tmpl Example template file for creating new front end users (fe_users). This template is used by the
static_template 'plugin.feadmin.fe_users'
Description
This class is used to create forms for database-administration in the front-end independently of the backend (TBE). Thus you
may want to use this, if you would like front-end users to edit database content.
Authentication goes through either fe_user login in which case you can stamp the records with the fe_user_uid so a record
belongs to a certain fe_user. The other authentication option is email authentication. In this case you have access to the
record if your email is found in a certain field. By fe_user authentication you can get a menu of items to edit when you're
logged in. With email-authentication, you can request an email to be sent to your email address. This email contains a list of
the available records.
It's all based on HTML-template files which you have to design by your self, so there's some design work to do. On the other
hand you get total freedom to design your forms.
Example:
See static_templates 'plugin.feadmin.*' for various examples. Test them configured on the TYPO3 testsite.
Static template
plugin.feadmin.*
141
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
Name: Description:
fD fixed Data (array of fields)
FE Frontend Edit data array, syntax, FE[tablename][fieldname] = value
fe_adminLib.inc properties
Property: Data type: Description: Default:
templateFile resource The template file, see examples in media/scripts/fe_user_admin.tmpl
templateContent string Alternatively you can set this property directly to the value of the
template.
table tablename The table to edit.
Notice: The ultimate lsit of fields allowed to be edited for the table is
defined in TCA with the key ["feInterface"]["fe_admin_fieldList"] for
each table in question. For an example, see the table definition for
fe_users which is a good example.
defaultCmd string Defines which action should be default (if &cmd= is not set when
calling the page)
clearCacheOfPages [list of integers] This is a list of page-ids for which to clear the cache on any successfull
operation be it EDIT, CREATE og DELETE.
debug boolean If set, debug information will be output from fe_adminLib which helps
to track errors.
Actions:
edit boolean If set, editing is basically allowed.
/actionObject But you need to specify:
142
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
Properties:
.dontLockPid (boolean) - selects only records from the .pid of
fe_adminLib.
.label (string) - The suffix for the markers, see 'Email Markers'
beneath.
143
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
Concept:
The 'setfixed' concept is best explained by describing a typical scenario
- in fact the most common situation of its use:
Imagine you have some users submitting information on your website.
But before that information enters the database, you would like to
moderate it - simply preview it and then either delete it or approve it.
In the 'create' configuration of fe_adminLib, you set up the hidden
field of the record to be overridden to 1. Thus the record is hidden by
default. Then you configure a setfixed-fixkey to set the hidden field to
0. This set up generates a list of parameters for use in an URL and
those parameters are finally inserted by a corresponding marker in the
email template. The link includes all necessary authentication to
perform the change of values and thus a single click on that link is
enough to change the field values. So this will - by a single click of a
link in a notification mail sent to an admin - enable the record! Or of
course a similar link with a cmd=delete link will delete it...
There is a special “fieldname” you can use, which is '_FIELDLIST” and
that lets you specify a list of fields in the record to base the auth-code
on. If nothing is specifyed the md5-hash is based on the whole record
which means that any changes will disable the setfixed link. If on the
other hand, you set _FIELDLIST = uid,pid then that record will be
editable as long as the uid and pid values are intact.
Example:
This is a common configuration of the email-properties with a simple
setfixed setting:
email.from = kasper@typo3.com
email.fromName = Kasper Skårhøj
email.admin = kasper@typo3.com
setfixed.approve {
hidden = 0
_FIELDLIST = uid,pid
}
setfixed.DELETE = 1
setfixed.DELETE._FIELDLIST = uid
###SYS_SETFIXED_approve###
&cmd=setfixed&rU=9&fD[hidden]=0&aC=5c403d90
Now, all you need is to point that to the correct url (where
fe_adminLib is invoked!), eg:
###THIS_URL######FORM_URL######SYS_SETFIXED_approve#
##
...###SYS_SETFIXED_DELETE###
Others
144
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
.addDate (date-config) You can use this to make the code time-
disabled. Say if you enter “d-m-Y” here as value, the code will work
until midnight and then a new code will be valid.
Advice:
If you want to generate authCodes compatible with the standard
authCodes (used by the direct mailer by t3lib_div::stdAuthCode()),
please set TYPO3_CONF_VARS[SYS][encryptionKey] to a unique and
secret key (like you should in any case) and add “uid” as
authcodeField ONLY. This is secure enough.
email .from (string, email) Defines the sender email address of mails sent
out
.fromName (string) Defines the name of the sender. If set, this will
be used on the form NAME <EMAIL>
formurl ->typolink Contains typolink properties for the URL (action tag) of the form.
145
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
Example:
Say, you set up a cObject like this:
cObject.myHeader = TEXT
cObject.myHeader.value = This is my header
then you can include this cObject in most of the templates through a
marker named ###CE_myHeader### or ###PCE_myHeader###
(see below for details on the difference).
wrap1 ->stdWrap Global Wrap 1. This will be splitted into the markers ###GW1B###
and ###GW1E###. Don't change the input value by the settings,
only wrap it in something.
Example:
wrap1.wrap = <b> |</B>
wrap2 ->stdWrap Global Wrap 2 (see above)
color1 string /stdWrap Value for ###GC1### marker (Global color 1)
color2 string /stdWrap Value for ###GC2### marker (Global color 2)
color3 string /stdWrap Value for ###GC3### marker (Global color 3)
[tsref:(script).fe_adminLib]
Main subparts
There are a certain system in the naming of the main subparts of the template file. These markers below is used when an
action results in “saving”. The [action] code may be DELETE, EDIT or CREATE depending on the cmd value.
146
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
Likewise there are a system in the subpart markers used for the EDIT and CREATE actions to display the initial forms:
###TEMPLATE_[action]### or if a fe_user is logged in (only CREATE): ###TEMPLATE_[action]_LOGIN###
Must-have subparts:
These are subparts that should exist in any template.
Subpart: Description:
###EMAIL_TEMPLATE_NORECORD###
###EMAIL_TEMPLATE_[infomail_key]###
###SUB_RECORD###
FORM conventions
The forms used with fe_adminLib should be named after the table their are supposed to edit. For instance if you are going to
edit records in the table 'fe_users' you must use a FORM-tag like this:
<FORM name=”fe_users_form” method=”POST” action=”....”>
The fields used to submit data for the records has this syntax, FE[tablename][fieldname]. This means, if you want to edit the
'city' field of a tt_address record, you could use a form element like this:
<INPUT name=”FE[tt_address][city]”>
147
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
Submit buttons can be named as you like except using the name “doNotSave” of a submit button will prevent saving. If you
need Cancel button, please resort to JavaScript in an onClick even to change document.location.
Common markers
###GW1B### / ###GW1E###: Global wrap 1, begin and end (headers)
###GW2B### / ###GW2E###: Global wrap 2, begin and end (bodytext)
###GC1### / ###GC2### / ###GC3###: Global color 1 through 3
###FIELD_[fieldname]###
where [fieldname] is the name of a field from the record. All fields in the record are used.
Finally you can insert cObjects defined in TypoScript with this series of markers (see .cObject property in table above):
###CE_[cObjectName]###
###PCE_[cObjectName]###
(###PCE_* is difference from ###CE_* cObjects by the fact they are rendered with a newly created cObj (as opposed to the
parant cObj of fe_adminLib) where the data-array is loaded with the value of ->dataArr which is the array submitted into the
script. This makes then useful for presenting preview data. Finally both PCE_ and CE_ types cObject markers may be used
with each single element in a edit menu (list of available records) by prefixing the marker with 'ITEM_', eg.
###ITEM_PCE_[cObjectName]###
are removed. If there is a simple “required”-error (a field is not filled in) then the SUB_REQUIRED_FIELDS_WARNING is not
removed and thus the error message contained herein is shown.
Lets say that more specifically it's the 'email' field in a form which is not filled in. Then you can put in a subpart named
###SUB_REQUIRED_FIELD_email###
This is normally removed, but it'll not be removed if the email field fails and thus you are able to give a special warning for
that specific field.
148
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
want to make sure that no email address is put into the database twice. Then you may specify that as:
create.evalValues {
email = uniqueLocal, email
}
If the error happens to be that the email address already exists the field ###EVAL_ERROR_FIELD_email### will be
substituted with the error message “Apparently you're already registered with this email address!”.
Notice the blue value names are the field values (must be rawurlencoded. In javascript this function is called escape()) and
the red values are necessary if you want to NOT save the record by this action and NOT to display error messages if some
fields which are required is not passed any value.
List of eval-codes
Eval-code: Description:
uniqueGlobal This requires the value of the field to be globally unique, which means it must not exist in the same field of
any other record in the current table.
uniqueLocal This is like uniqueGlobal, but the value is required to be unique only in the PID of the record. Thus if two
records has different pid values, they may have the same value of this field.
twice This requires the value of the field to match the value of a secondary field name [fieldname]_again sent in
the incoming formdata. THis is useful for entering password. Then if your password field is name
“user_pass” then you simple add a second field name “user_pass_again” and then set the 'twice' eval code.
email Requires the field value to be an email address at least on the form [name]@*[domain].[tld]
required Just simple required (trimmed value). 0 (zero) will evaluate to false!
unsetEmpty This evaluation does not result in any error code. Only it simply unsets the field if the value of the field is
empty. Thus it'll not override any current value if the field value is not set.
[tsref:(script).fe_adminLib.evalErrors.(field).(evalCode)]
Uploading files
fe_adminLib is able to receive files in the forms. However there currently are heavy restrictions on how that is handled. Ideally
the proces would be handled by the t3lib_tcemain class used in the backend. In fact this could have been deployed but is not
at this stage. The good thing about tcemain.php is that it perfectly handles the copying/deletion of files which goes into a
certain field and even handles it independent of the storing method be it a list of filenames or use MM-relations to records
(see tables.php section in 'Inside TYPO3').
This is how files are handled by fe_adminLib and the restrictions that apply currently:
• You can upload files ONLY using “create” mode of a record. In any case you cannot edit currently attached files (this may
be improved in the future). You can however use 'delete' mode.
• However you can use PREVIEW mode with 'create'. Works like this: if the mode is preview the temporary uploaded file is
copied to a unique filename (prepended with the tablename) in typo3temp/ folder. Then the field value is set to the
149
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
filenames in a list. When the user approves the content of the preview those temporary files are finally copied to the
uploads/* folder (or whereever specified in TCA). Limitations are that the temporary files in typo3temp/ are NOT deleted
when copied to the real upload-folder (this may be improved) and certainly not if the user aborts (can't be improved
because the user may go anywhere). If the user cancels the preview in order to change values, the files will need to be
uploaded again (this may be improved).
• The TCA extensions allowed for the field is ignored! However you can specify a list of extensions of allowed for the files in
the .parseValues property of fe_adminLib
• The TCA filesize limitation for the field is ignored! However you can specify a max file size in kb in the .parseValues
property of fe_adminLib
• Works only on fields configured for comma-list representation of the filenames (non-MM, see “Inside TYPO3” document on
MM relations for files).
It's recommended to use a dedicated folder for files administered by the fe_adminLib. The TYPO3 testsite does that by using
the uploads/photomarathon/ folder for images. This makes it much easier to clean up the mess if files and their relations to
the records are broken.
If you wish to upload multiple files to that field, the form-elements should look like:
<input type="file" name="FE[user_cars][picture][]">
<input type="file" name="FE[user_cars][picture][]">
<input type="file" name="FE[user_cars][picture][]">
Use blob-types for the file-fields and reserve a minimum of 32 characters pr. filename.
NOTE: Make sure to always add the last square brackets ('...[]') to the fieldname! Otherwise it will not work!
150
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
tipafriendLib.inc
Files:
File: Description:
tipafriendLib.inc Main class used to display the Tip-a-Friend form
Call it from a USER cObject with 'userFunc = user_tipafriend->main_tipafriend'
tipafriend_template.tmpl Example template file.
Description
Example:
(See static_template 'plugin.tipafriend' for a working configuration)
Static template
plugin.tipafriend
tipafriendLib.inc properties
Property: Data type: Description: Default:
templateFile resource The template-file.
See example in 'media/scripts/tipafriend_template.tmpl'
code string /stdWrap Code to define, what the script does. Case sensitive.
defaultCode string The default code (see above) if the value is empty. By default it's not set
and a help screen will appear
151
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
Example:
wrap1.wrap = <B> |</B>
wrap2 ->stdWrap Global Wrap 2 (see above)
color1 string /stdWrap Value for ###GC1### marker (Global color 1)
color2 string /stdWrap Value for ###GC2### marker (Global color 2)
color3 string /stdWrap Value for ###GC3### marker (Global color 3)
typolink ->typolink TypoLink configuration for the TIPLINK to the TIPFORM page.
.additionalParams is added the parameter “&tipUrl=”
htmlmail boolean If set, the page is fetched as HTML and send in HTML (a plain text version
is sent as well).
[tsref:(script).tipafriend]
plaintextLib.inc
Files:
File: Description:
plaintextLib.inc Main class used to display plain text content
Call it from a USER cObject with 'userFunc = user_plaintext->main_plaintext'
plaintext_content.tmpl Example template file.
Description
Example:
(See static_template 'plugin.alt.plaintext' for a working configuration)
Static template
plugin.alt.plaintext
plaintextLib.inc properties
Property: Data type: Description: Default:
siteUrl url Url of the site.
defaultOutput untrimmed string Default output if CType is not rendered.
uploads.header untrimmed string Header for uploads
images.header untrimmed string Header for images
images.captionHeader untrimmed string Header for imagecaptions
images.linkPrefix untrimmed string Prefix for image-links
.header
defaultType int Which type to use as default
date date-config For header date
datePrefix untrimmed string Prefix for header date
linkPrefix untrimmed string Prefix for header links
[1-5].preLineLen int Lenght of line before header
[1-5].postLineLen int Lenght of line after header
[1-5].preBlanks int Number of blank lines before header
152
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
Datatype 'untrimmed string' means that you can enter a string as usual, but if you enter a value between two vertical lines,
that value will be used and NOT trimmed. Normally values are trimmed.
Example:
lib.renderObj = USER
lib.renderObj.userFunc = user_plaintext->main_plaintext
lib.renderObj {
header.defaultType = 1
header.date = D-m-Y
header.datePrefix = |Date: |
header.linkPrefix = | - Headerlink: |
header.1.preLineLen = 76
header.1.postLineLen = 76
header.1.preBlanks=1
header.1.stdWrap.case = upper
header.3.preBlanks=2
header.3.postBlanks=1
header.3.stdWrap.case = upper
header.5.preBlanks=1
header.5.autonumber=1
header.5.prefix = |: >> |
siteUrl = {$plugin.alt.plaintext.siteUrl}
defaultOutput (
|
[Unrendered Content Element; ###CType### ]
|
)
uploads.header = |DOWNLOADS:|
images.header = |IMAGES:|
images.linkPrefix = | - Imagelink: |
images.captionHeader = |CAPTION:|
153
TypoScript Reference - doc_core_tsref media/scripts/ Plugins
bulletlist.0.bullet = |* |
bulletlist.1.bullet = |# |
bulletlist.2.bullet = | - |
bulletlist.3.bullet = |> |
bulletlist.3.secondRow = |. |
bulletlist.3.blanks = 1
menu = <tt_content.menu.20
shortcut = <tt_content.shortcut.20
shortcut.0.conf.tt_content = <lib.renderObj
shortcut.0.tables = tt_content
bodytext.stdWrap.parseFunc.tags {
link < styles.content.parseFunc.tags.link
typolist = USER
typolist.userFunc = user_plaintext->typolist
typolist.siteUrl = {$plugin.alt.plaintext.siteUrl}
typolist.bulletlist < temp.renderObj.bulletlist
typohead = USER
typohead.userFunc = user_plaintext->typohead
typohead.siteUrl = {$plugin.alt.plaintext.siteUrl}
typohead.header < temp.renderObj.header
typocode = USER
typocode.userFunc = user_plaintext->typocode
typocode.siteUrl = {$plugin.alt.plaintext.siteUrl}
}
}
154
TypoScript Reference - doc_core_tsref Standard Templates
Standard Templates
static_template
This section of the TypoScript reference is used to introduce the standard templates that follows with TYPO3 in the static table
"static_template". You should not alter this table yourself but rather submit suggestions via the www.typo3.com-website if you
want to correct errors or add templates or other pieces of TypoScript.
The "static_template" is published in new versions. The old records in the static_template are NOT changed from version to
version (when finally released) unless they are under development and explicitly tagged with a note saying they are still not
fixed! Still changes may appear though as long as The TYPO3 project is not finally released!
Media
The standard templates uses some standard media-files, likes gif-images and fonts. These are situated in the folder "media/"
relative to the root of the TYPO3-website.
155
TypoScript Reference - doc_core_tsref PHP include scripts
$conf
The array $conf contains the configuration for the PHP_SCRIPT cObject. Try debug($conf) to see the content printed out for
debugging!
$content
Return all content in this variable.
Remember, don't output anything (but debug code) in your script!
Whitespace
Because nothing is sent off to the browser before everything is rendered and returned to index_ts.php which originally set of
the rendering process, you must ensure that there's no whitespace before and after your <?...?> tags in your include- or
library-scripts!
$GLOBALS["TSFE"]->set_no_cache()
Call the function $GLOBALS["TSFE"]->set_no_cache(), if you want to disable caching of the page. Call this during
development! And call it, if the content you create may not be cached.
NOTE: If you make a syntax error in your script that keeps PHP from executing it, then the $GLOBALS["TSFE"]-
>set_no_cache() function is not executed and the page is cached! So in such situations, correct the error, clear the page-
cache and try again. This is true only for PHP_SCRIPT and not PHP_SCRIPT_INT and PHP_SCRIPT_EXT which are rendered
after the cached page!
Example:
$GLOBALS["TSFE"]->set_no_cache();
Example:
$content=$this->cObjGetSingle($conf["image"], $conf["image."]);
This would return any IMAGE-cObject at the property "image" of the conf-array for the include-script!!
156
TypoScript Reference - doc_core_tsref PHP include scripts
Example:
$content = $this->stdWrap($content, $conf["stdWrap."]);
This will stdWrap the content with the properties of ".stdWrap" of the $conf-array!
Internal Vars in the main frontend object, TSFE (TypoScript Front End)
There are some vars in the global object, TSFE, you might need to know about. These ARE ALL READ-ONLY!! (Read: Don't
change them!). See the class tslib_fe for the full descriptions.
You access them like this example with “id”: $GLOBALS["TSFE"]->id
Global vars
Var: PHP-Type: Description: Default:
BE_USER object The back-end user object (if any) not set
TYPO3_CONF_VARS array TYPO3 Configuration
TSFE object main frontend object.
157
TypoScript Reference - doc_core_tsref Case story
Case story
This is a casestory of how to use include-scripts.
In this situation we would like to use some libraries of our very own, not part of TYPO3. Therefore we use the feature of
including a library at the very beginning of the page-parsing.
First we put this TypoScript line in the "Setup"-field of the template:
config.includeLibrary = fileadmin/scripts/include.inc
The file include.inc is now included (in typo3/sysext/cms/tslib/pagegen.php). In this case it looks like this:
file: fileadmin/scripts/include.inc
<?
...
include("fileadmin/scripts/hello_world.inc");
include("fileadmin/scripts/other_library.inc");
...
?>
As you can see, this file includes our library "hello_world" and some other libraries too!
So far nothing has happend, except our libraries are included, ready for use.
Now we need to use the outcome of the hello_world class somewhere on a page. So in the TypoScript code we setup a
content-object that includes the third script:
page.100 = PHP_SCRIPT
page.100.file = fileadmin/scripts/surprise.inc
file: fileadmin/scripts/surprise.inc
<?
$hello_world_object = new hello_world; // New instance is created
$contentBefore = $this->cObjGetSingle($conf["cObj"],$conf["cObj."]);
$content = $contentBefore.$hello_world_object->theMessage();
$content = $this->stdWrap($content,$conf["stdWrap."]);
?>
158
TypoScript Reference - doc_core_tsref Case story
The output:
With this configuration -
page.100 = PHP_SCRIPT
page.100.file = fileadmin/scripts/surprise.inc
Hello World
End of lesson.
$GLOBALS["TSFE"]->fe_user->getKey(type, key)
"type" is either "user" or "ses", which defines the data-space, user-data or session-data
159
TypoScript Reference - doc_core_tsref Case story
"key" is the "name" under which your data is stored. This may be arrays or normal scalars.
Note that the key "recs" is reserved for the built-in "shopping-basket". As is "sys" (for TYPO3 standard modules and code)
Example:
if ($GLOBALS["TSFE"]->loginUser) {
$myData = $GLOBALS["TSFE"]->fe_user->getKey("user","myData");
} else {
$myData = $GLOBALS["TSFE"]->fe_user->getKey("ses","myData");
}
This gets the stored data with the key "myData" from the user-data, but if no user is logged in, it's fetched from the session
data instead.
Example:
$myConfig["name"] = "paul";
$myConfig["address"] = "Main street";
$GLOBALS["TSFE"]->fe_user->setKey("ses","myData", $myConfig);
This stores the array $myConfig under the key "myData" in the session-data. This lasts as long as "paul" is surfing the site!
Example:
This form-element will change the registered value of record with uid=345 from the "tt_products" table in typo3. Please note,
that the record itself is NOT in any way modified, only the "counter" in the session-data indicating the "number of items" from
the table is modified.
<input name="recs[tt_products][345]">
NOTE on checkboxes:
When you are creating forms with checkboxes, the value of the checkbox is sent by MSIE/Netscape ONLY if the checkbox is
checked! If you want a value sent in case of a disabled checkbox, include a hidden formfield of the same name just before the
checkbox!
Example:
160
TypoScript Reference - doc_core_tsref Case story
161
TypoScript Reference - doc_core_tsref index.php
index.php
Introduction
index.php is the main script for showing pages with TYPO3 / TypoScript. This page show some information about this script
and how to use it.
Normally you request pages by setting a value for "id" and possibly "type".
"id" refers to a page. This is an integer. If a string is supplied, it's regarded as an alias and the corresponding page is found.
"type" defines which "type" the page is. Always an integer (0-255). If "type" is not set it's regarded to be zero. "type" is used
to build framesets. Fx. the frameset would have "type=0" (or nothing) and the pages in the various frames would have
"type=1" and "type=2" and "type=3". In TypoScript you define a PAGE-object for each type so TYPO3 renders different pages
depending on the type-value. Normally the PAGE-object displaying the page content is named "page" and has the "type=1"
value.
Login/Logout:
Detected by class "t3lib_userauth" looking for the var "logintype". If this is set, authentication is done.
Input may be of both GET and POST method.
Login:
logintype = "login"
pass = the password
user = the username
pid = the id of the page where the user-archive is found. You don't need this value if the TYPO3_CONF_VARS[FE]
[checkFeUserPid] is set.
(redirect = No use)
Logout:
logintype = "logout"
Search:
Detected by the cObject SEARCHRESULT, which proceeds with a search if "sword" && "scols" are set. The search MUST
submit to a page with such a content-object on!
Input may be of both GET and POST method.
Search:
sword = the searchwords
stype = the search type
scols = the tables/columns to search
locationData = Reference to the record carrying the form. Used to look up the original startingpoint of the search
(ONLY POST-method)
(redirect = No use)
162
TypoScript Reference - doc_core_tsref index.php
163
TypoScript Reference - doc_core_tsref index.php
Emailforms:
Detected by the mainscript "index.php" looking for the var "formtype_mail" to be set. (could be the submit-button)
Input MUST be POST method. And the REFERER and HTTP_HOST must match. Also the locationData var must be sent and at
least point to the uid of a readable page.
Database-submit
Detected by the mainscript "index.php" looking for the var "formtype_db" to be set. (could be the submit-button)
Input MUST be POST method. And the REFERER and HTTP_HOST must match. To setup a script to handle the input, refer to
the FE_DATA object.
See examples from the typo3/sysext/cms/tslib/media/scripts/ folder, eg. "guest_submit.inc"
164