TSref/split
From TYPO3Wiki
| TSref/split |
|
||||
TypoScript TypoScript 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)
# Example
20 = TEXT
20.field = bodytext
20.split {
token.char = 10
cObjNum = 1
1.current = 1
1.wrap = <TR><TD valign="top"><IMG src="dot.gif"></TD><TD valign="top"> | </TD></TR>
}
20.wrap = | Property: | Data type: | Description: | Default: |
| token | str /stdWrap | string or character (token) used to split the value | |
| max | int /stdWrap | max number of splits | |
| min | int /stdWrap | min number of splits. | |
| returnKey | int /stdWrap | Instead of parsing the split result, just return this element of the index immediately. | |
| cObjNum | cObjNum | This is a pointer the array of this object ("1,2,3,4"), that should treat the items, resulting from the split. | |
| 1,2,3,4 | CARRAY /stdWrap | The object that should treat the value.
NOTE: The "current"-value is set to the value of current item, when the objects are called. See "stdWrap" / current. Example (stdWrap used): 1.current = 1 1.wrap = <B> | </B> Example (CARRAY used): 1 {
10 = TEXT
10.current = 1
10.wrap = <B> | </B>
20 = CLEARGIF
20.height = 20
}
| |
| wrap | wrap
+optionSplit | Defines a wrap for each item. |
[tsref:->split]
