TEXT¶
The content object “TEXT” can be used to output static text or HTML.
stdWrap properties are available under the property “value” and on the very rootlevel of the object.
Note: Gifbuilder also has a TEXT object - do not mix that one up with the cObject described here; both are different objects.
Property
(stdWrap properties…)
Data type
Description
stdWrap properties are available on the very rootlevel of the object. This is non-standard! You should use these stdWrap properties consistently to those of the other cObjects by accessing them through the property “stdWrap”.
[tsref:(cObject).TEXT]
Examples:¶
10 = TEXT
10.value = This is a text in uppercase
10.stdWrap.case = upper
The above example uses the stdWrap property “case”. It returns “THIS IS A TEXT IN UPPERCASE”.
10 = TEXT
10.value.field = title
10.stdWrap.wrap = <strong>|</strong>
The above example gets the header of the current page (which is stored in the database field “title”). The header is then wrapped in <strong> tags, before it is returned.
Now let us have a look at an extract from a more complex example:
10 = TEXT
10.value.field = bodytext
10.stdWrap.parseFunc < lib.parseFunc_RTE
10.stdWrap.dataWrap = <div>|</div>
The above example returns the content, which was found in the field “bodytext” of the current record from $cObj->data-array. Here that shall be the current record from the database table tt_content. This is useful inside COA objects.
Here is the same example in its context:
10 = CONTENT
10 {
table = tt_content
select {
andWhere.dataWrap = irre_parentid = {field:uid}
begin = 0
}
renderObj = COA
renderObj {
stdWrap.if.isTrue.data = field:bodytext
10 = TEXT
10.value.field = bodytext
10.stdWrap.parseFunc < lib.parseFunc_RTE
10.stdWrap.dataWrap = <div>|</div>
}
}
Here we use the cObject CONTENT to return all content elements (records from the database table “tt_content”), which are on the current page. (These content elements have the corresponding value in “irre_parentid”.) They are rendered using a COA cObject, which only processes them, if there is content in the field “bodytext”.
The resulting records are each rendered using a TEXT object:
The TEXT object returns the content of the field “bodytext” of the according tt_content record. (Note that the property “field” in this context gets content from the table “tt_content” and not - as in the example above - from “pages”. See the description for the data type “getText”/field!) The resulting content is then parsed with parseFunc and finally wrapped in <div> tags before it is returned.