TSref/cObject
Content Objects (cObject)
The content objects (cObjects) are primarily controlled by the PHP-script "typo3/sysext/cms/tslib/content.php". The PHP-class is named "tslib_cObj" and often this is also the variable-name of the objects ($cObj)
The $cObj in PHP has an array, $this->data, which holds records of various kind. See data type getText.
This record is normally "loaded" with the record from a table depending on the situation.
Example: if you are creating a menu, this record is often loaded with the page-record of the actual menuitem.
Example2: if it is about content-rendering, the record will be loaded with the content-record.
IMPORTANT NOTE
When dealing with "cObjects", you are 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!
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 page.20 = < page.10 page.20.case = lower page.20.value > page.20.field = pages
The result is this config:
Notice that .value was not cleared (the red line), because it's simply two arrays which are joined:
So hence the red line in the above example is useless.
A list of content objects:
- HTML
- TEXT
- COBJ_ARRAY / COA / COA_INT Content-Object-Array http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/4/
- FILE http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/5/
- IMAGE http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/6/
- IMG_RESOURCE http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/7/
- CLEARGIF http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/8/
- CONTENT http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/9/
- RECORDS http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/10/
- HMENU http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/11/
- CTABLE http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/12/
- OTABLE http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/13/
- COLUMNS http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/14/
- HRULER http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/15/
- IMGTEXT http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/16/
- CAST http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/17/
- LOAD_REGISTER http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/18/
- RESTORE_REGISTER http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/19/
- FORM http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/20/
- SEARCHRESULT http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/21/
- USER und USER_INT http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/22/
- PHP_SCRIPT http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/23/
- PHP_SCRIPT_INT http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/24/
- PHP_SCRIPT_EXT http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/25/
- TEMPLATE http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/26/
- MULTIMEDIA http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/27/
- EDITPANEL http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/28/