The content objects (cObjects) are primarily controlled by the PHP-script "typo3/sysext/cms/tslib/class.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. Say if you are creating a menu it's often loaded with the page-record of the actual menuitem or if it's about content-rendering it'll be the content-record.
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
}
First lib.stdheader is defined. This is (and must be) a cObject! (In this case it is 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.
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 cannot override values TypoScript-style (using the operators and all) the properties of the object which has the reference will be merged with the configuration of the reference.
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.
The content object "HTML" can be used to output static text or html. stdWrap is available for the cObject itself and for the property "value". See the examples.
Property: | Data type: | Description: | Default: |
---|---|---|---|
value | HTML /stdWrap | Raw HTML-code. | |
stdWrap | ->stdWrap | (Executed after the stdWrap for the property ".value".) |
[tsref:(cObject).HTML]
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.
Property: | Data type: | Description: | Default: |
---|---|---|---|
value | value /stdWrap | text, wrap with stdWrap properties | |
(stdWrap properties...) |
[tsref:(cObject).TEXT]
This cObject has the alias COA standing for "content object array". You can use "COA" this instead of COBJ_ARRAY.
You can also create this object as a COA_INT in which case it works exactly like the PHP_SCRIPT_INT object does: It's rendered non-cached! The COA_INT provides a way to utilize this feature not only with PHP_SCRIPT cObjects but with any cObject.
Property: | Data type: | Description: | Default: |
---|---|---|---|
1,2,3,4... | cObject | ||
if | ->if | if "if" returns false the COA is NOT rendered | |
wrap | wrap /stdWrap | ||
stdWrap | ->stdWrap | ||
includeLibs | list of resource /stdWrap | (This property is used only if the object is COA_INT!, See introduction.) 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).COA/(cObject).COA_INT/(cObject).COBJ_ARRAY]
temp.menutable = COBJ_ARRAY
temp.menutable {
10 = HTML
10.value = <table border=0 cellpadding=0 cellspacing=0>
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>
}
PHP-function: $this->fileResource()
Property: | Data type: | Description: | Default: |
---|---|---|---|
file | resource /stdWrap | If the resource is jpg,gif,jpeg,png, the image is inserted as an image-tag. All other formats are read and inserted into the HTML-code. The maximum filesize of documents to be read is set to 1024 kb internally! | |
linkWrap | linkWrap /stdWrap | (Executed before ".wrap" and ".stdWrap".) | |
wrap | wrap /stdWrap | (Executed after ".linkWrap" and before ".stdWrap".) | |
stdWrap | ->stdWrap | (Executed after ".linkWrap" and ".wrap".) | |
altText titleText | string /stdWrap | For <img> output only! If no alttext is specified, it will use an empty alttext. | |
emptyTitleHandling | string /stdWrap | Value can be "keepEmpty" to preserve an empty title attribute, or "useAlt" to use the alt attribute instead. | useAlt |
longdescURL | string /stdWrap | For <img> output only! "longdesc" attribute (URL pointing to document with extensive details about image). |
[tsref:(cObject).FILE]
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.
Property: | Data type: | Description: | Default: |
---|---|---|---|
file | imgResource | ||
params | <IMG>-params /stdWrap | ||
border | integer | Value of the "border" attribute of the image tag. | 0 |
altText titleText (alttext) | string /stdWrap | If no alt text is specified, an empty alt text will be used. ("alttext" is the old spelling of this attribute. It is deprecated since TYPO3 4.3 and will be used only if "altText" does not specify a value or properties.) | |
emptyTitleHandling | string /stdWrap | Value can be "keepEmpty" to preserve an empty title attribute, or "useAlt" to use the alt attribute instead. | useAlt |
longdescURL | string /stdWrap | "longdesc" attribute (URL pointing to document with extensive details about image). | |
linkWrap | linkWrap /stdWrap | (before ".wrap") | |
imageLinkWrap | boolean/ ->imageLinkWrap | NOTE: ONLY active if linkWrap is NOT set and file is NOT GIFBUILDER (as it works with the original imagefile) | |
if | ->if | if "if" returns false the image is not shown! | |
wrap | wrap /stdWrap | ||
stdWrap | ->stdWrap |
[tsref:(cObject).IMAGE]
Returns only the image-reference, possibly wrapped with stdWrap. May be used for putting background images in tables or table-rows or to import an 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.
Property: | Data type: | Description: | Default: |
---|---|---|---|
file | imgResource | ||
stdWrap | ->stdWrap |
[tsref:(cObject).IMG_RESOURCE]
Inserts a transparent gif-file.
Property: | Data type: | Description: | Default: |
---|---|---|---|
height | <img>-data:height /stdWrap | Height of the image. | 1 |
width | <img>-data:width /stdWrap | Width of the image. | 1 |
wrap | wrap /stdWrap | |<br /> | |
stdWrap | ->stdWrap | (Executed after ".wrap".) |
[tsref:(cObject).CLEARGIF]
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.
Property: | Data type: | Description: | Default: |
---|---|---|---|
select | ->select | The SQL-statement is set here! | |
table | TableName /stdWrap | The table, the content should come from. In standard configuration this will be "tt_content" NOTE: Allowed tables are "pages" or tables prefixed with one of these: "tt_", "tx_", "ttx_", "fe_", "user_" or "static_" | |
renderObj | cObject | < [tablename] | |
slide | integer /stdWrap | If set and no content element is found by the select command, then the rootLine will be traversed back until some content is found. Possible values are "-1" (slide back up to the siteroot), "1" (only the current level) and "2" (up from one level back). Use -1 in combination with collect. .collect (integer /stdWrap): If set, all content elements found on current and parent pages will be collected. Otherwise, the sliding would stop after the first hit. Set this value to the amount of levels to collect on, or use "-1" to collect up to the siteroot. .collectFuzzy (boolean /stdWrap): Only useful in collect mode. If no content elements have been found for the specified depth in collect mode, traverse further until at least one match has occurred. .collectReverse (boolean /stdWrap): Change order of elements in collect mode. If set, elements of the current page will be at the bottom. | |
wrap | wrap /stdWrap | Wrap the whole content-story... | |
stdWrap | ->stdWrap | (Executed after ".wrap".) |
[tsref:(cObject).CONTENT]
1 = CONTENT
1.table = tt_content
1.select {
pidInList = this
orderBy = sorting
}
// Configuration for records with the typeField-value (often "CType") set to "header"
tt_content.header.default {
10 = TEXT
10.field = header
.....
}
// 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 used, 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 {
.....
}
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.
Property: | Data type: | Description: | Default: |
---|---|---|---|
source | records-list /stdWrap | List of record-id's, optionally with prepended table-names. Example: source = tt_content_34, 45, tt_links_56 | |
tables | list of tables /stdWrap | List of accepted tables. If any items in the ".source"-list are not prepended with a table name, the first table in this list is assumed to be the table for such records. Also table names configured in .conf are allowed. Example: tables = tt_content, tt_address, tt_links conf.tx_myexttable = TEXT conf.tx_myexttable.value = Hello world This adds the tables tt_content, tt_address, tt_links and tx_myexttable. | |
conf.[tablename] | cObject | Config-array which renders records from table tablename | If this is NOT defined, the rendering of the records is done with the toplevel-object [tablename] - just like the cObject, CONTENT! |
dontCheckPid | boolean /stdWrap | Normally a record cannot be selected, if its parent page (pid) is not accessible for the website user. This option disables that check. | |
wrap | wrap /stdWrap | ||
stdWrap | ->stdWrap | (Executed after ".wrap".) |
[tsref:(cObject).RECORDS]
Generates hierarchical menus.
Property: | Data type: | Description: | Default: |
---|---|---|---|
(1 / 2 / 3 /...) | menuObj | Required! Defines which menuObj that should render the menu items on the various levels. 1 is the first level, 2 is the second level, 3 is the third level, 4 is .... Example: temp.sidemenu = HMENU temp.sidemenu.1 = GMENU | (no menu) |
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. 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... | 0 |
special | "directory" / "list" / "updated" / "browse" / "rootline" / "keywords" / "language" | See section "The .special property" and the according tables below. | |
special.value | list of page-uid's /stdWrap | See above | |
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. Notice: Affects all sub menus as well. (See "minItems" for notice) | |
begin | int +calc | The first item in the menu. Example: This results in a menu, where the first two items are skipped starting with item number 3: begin = 3 Notice: Affects all sub menus as well. (See "minItems" for notice) | |
excludeUidList | list of integers | This is a list of page uid's to exclude when the select statement is done. Comma-separated. You may add "current" to the list to exclude the current page. 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 menus. By default pages that are "not in menu" (5) are excluded and those marked for backend user access only (6). | 5,6 |
includeNotInMenu | boolean | If set, pages with the checkbox "Not in menu" checked will be included in menus. | |
alwaysActivePIDlist | list of integers /stdWrap | This is a list of page UID numbers that will always be regarded as active menu items and thereby automatically opened regardless of the rootline. | |
protectLvar | boolean / keyword | If set, then for each page in the menu it will be checked if an Alternative Page Language record for the language defined in "config.sys_language_uid" (typically defined via &L) exists for the page. If that is not the case and the pages "Localization settings" have the "Hide page if no translation for current language exists" flag set, then the menu item will link to a non accessible page that will yield an error page to the user. Setting this option will prevent that situation by simply adding "&L=0" for such pages, meaning that they will switch to the default language rather than keeping the current language. The check is only carried out if a translation is requested ("config.sys_language_uid" is not zero). 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. For these options to make sense, they should only be used when "config.sys_language_mode" is not set to "content_fallback". | |
addQueryString | string | see typolink.addQueryString Notice: This works only for special=language. | |
if | ->if | If "if" returns false, the menu is not generated | |
wrap | wrap /stdWrap | ||
stdWrap | ->stdWrap | (Executed after ".wrap".) |
[tsref:(cObject).HMENU]
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
ACT < .NO
ACT = 1
ACT.linkWrap = <b>{$fontTag}</b>
}
This property makes it possible to create menus that are not strictly reflecting the current page-structure, but rather creating menus with links to pages like "next/previous", "last modified", "pages in a certain page" and so on.
Note: .entryLevel generally is not supported together with the .special property! The only exception is special.keywords.
Also be aware that this property selects pages for the first level in the menu. Submenus by menuObjects 2+ will be created as usual.
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.
Property: | Data type: | Description: | Default: |
---|---|---|---|
value | list of page ids /stdWrap | This will generate a menu of all pages with pid = 35 and pid = 56. 20 = HMENU 20.special = directory 20.special.value = 35, 56 | current page id |
[tsref:(cObject).HMENU.special.directory]
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.
Property: | Data type: | Description: | Default: |
---|---|---|---|
value | list of page ids /stdWrap | This will generate a menu with the two pages (uid=35 and uid=56) listed: 20 = HMENU 20.special = list 20.special.value = 35, 56 If .value is not set, the default uid is 0, so that only your homepage will be listed. | 0 |
[tsref:(cObject).HMENU.special.list]
An 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 (e.g. TMENU or GMENU, see later) will override that.
Mount pages are supported.
Property: | Data type: | Description: | Default: |
---|---|---|---|
value | list of page ids /stdWrap | This will generate a menu of the most recently updated pages from the branches in the tree starting with the uid's (uid=35 and uid=56) listed. 20 = HMENU 20.special = updated 20.special.value = 35, 56 | |
mode | string | The field in the database which should be used to get the information about the last update from. The following values are possible: - SYS_LASTCHANGED: Is updated to the youngest tstamp of the records on the page when a page is generated. - crdate: Uses the "crdate"-field of the pagerecord. - tstamp: Uses the "tstamp"-field of the pagerecord, which is set automatically when the record is changed. - manual or lastUpdated: Use the field "lastUpdated", which can be set manually in the page-record. - starttime: Uses the starttime field. Fields with empty values are generally not selected. | SYS_LASTCHANGED |
depth | int | Defines the tree depth. The allowed range is 1-20. A depth of 1 means only the start id, depth of 2 means start-id + first level. Notice: "depth" is relative to "beginAtLevel". | 20 |
beginAtLevel | int | Determines starting level for the page trees generated based on .value and .depth. 0 is default and includes the start id. 1 starts with the first row of subpages, 2 starts with the second row of subpages. Notice: "depth" is relative to this property. | 0 |
maxAge | int (seconds) +calc | Pages with update-dates older than the current time minus this number of seconds will not be shown in the menu no matter what. Default is "not used". You may use +-*/ for calculations. | |
limit | int | Maximal number of items in the menu. Default is 10, max is 100. | 10 |
excludeNoSearchPages | boolean | If set, pages marked "No search" are not included. | 0 |
[tsref:(cObject).HMENU.special.updated]
The following example will generate a menu of the most recently updated pages from the branches in the tree starting with the uid's (uid=35 and uid=56) listed. Furthermore the field "tstamp" is used (default is SYS_LASTCHANGED) and the tree depth is 2 levels. Also a maximum of 8 pages will be shown and they must have been updated within the last three days (3600*24*3):
20 = HMENU
20.special = updated
20.special.value = 35, 56
20.special {
mode = tstamp
depth = 2
maxAge = 3600*24*3
limit = 8
}
The path of pages from the current page to the root page of the page tree is called "rootline".
A rootline menu is a menu which shows you these pages one by one in their hierarchical order.
An 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
Such a click path facilitates the user's orientation on the website and makes navigation to a certain page level easier.
Mount pages are supported.
Property: | Data type: | Description: | Default: |
---|---|---|---|
range | string /stdWrap | [begin-level] | [end-level] (same way as you reference the .entryLevel for an HMENU). The following example will start at level 1 and not show the page the user is currently on: temp.breadcrumbs = HMENU temp.breadcrumbs.special = rootline temp.breadcrumbs.special.range = 1|-2 | |
reverseOrder | boolean | If set to true, the order of the rootline menu elements will be reversed. | false |
targets.[level number] | string | For framesets. You can set a default target and a target for each level by using the level number as sub-property. Example: Here the links to pages on level 3 will have target="page", while all other levels will have target="_top" as defined for the TMENU property .target. 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]
The following example will generate an accessible rootline menu: It will be wrapped as an unordered list. The first page in the menu is the page on level 1, that is one level below the root page of the website. The last page in the menu is the current page.
After each link there is an image, which could contain a small arrow.
The current page is not linked, but wrapped in em tags. It does not have the image appended.
20 = HMENU
20.wrap = <ul>|</ul>
20.special = rootline
20.special.range = 1|-1
20 {
1 = TMENU
1.noBlur = 1
1.NO.wrapItemAndSub = <li>|</li>
1.NO.ATagTitle.field = description // subtitle // title
1.NO.afterImg = fileadmin/arrow.jpg
1.CUR = 1
1.CUR < .1.NO
1.CUR.doNotLinkIt = 1
1.CUR.wrapItemAndSub = <li><em>|</em></li>
1.CUR.afterImg >
}
Warning: Mount pages are not supported!
This menu contains pages which give your user the possibility to browse to the previous page, to the next page, to a page with the table of contents and so on. The menu is built of items given by a list from the property ".items".
Property: | Data type: | Description: | Default: |
---|---|---|---|
value | int/stdWrap | Default is the current page id. Seldom you might want to override this value with another page-uid which will then act as the base point for the menu and the predefined items. | current page id |
items | list of item names separated by "|" | Each element in the list (separated by "|") is either a reserved item name (see list) with a predefined function, or a user-defined name which you can assign a link to any page. Note that the current page cannot be the root-page of a site. Reserved item names: next / prev: Links to the next page / the 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 the next section / to the last page of the previous section, too. nextsection / prevsection: Links to the next section / the 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 the parent page of the current page is the root page of the site.
first / last: First / last page on the 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: If id=20 is the current page then: 21= prev and first, 19 = next, 18 = last, 17 = up, 1=index, 10 = nextsection, 11 = nextsection_last prevsection and prevsection_last is not present because id=3 has no subpages! TypoScript (only "browse"-part, needs also TMENU/GMENU): xxx = HMENU xxx.special = browse xxx.special { items = index|up|next|prev items.prevnextToSection = 1 index.target = _blank index.fields.title = INDEX index.uid = 8 } | |
items.prevnextToSection | boolean | If set, the "prev" and "next" navigation will jump to the next section when it reaches the end of pages in the current section. That way "prev" and "next" will also link to the first page of the next section / to the last page of the previous section. | |
[itemname].target | string | Optional/alternative target of the item. | |
[itemname].uid | int | (uid of page) - optional/alternative page-uid to link to. | |
[itemname].fields.[field name] | string | Override field "field name" in pagerecord. Example: This gives the link to the previous page the linktext "« zurück". prev.fields.title = « zurück |
[tsref:(cObject).HMENU.special.browse]
Makes a menu of pages, which contain one or more keywords also found on the current page.
Ordering is by default done in reverse order (desc) with the field specified by "mode", but setting "alternativeSortingField" for the menu object (e.g. for a GMENU, see later) will override that.
Mount pages are supported.
Property: | Data type: | Description: | Default: |
---|---|---|---|
value | int/stdWrap | Page for which keywords to find similar pages Example: 20 = HMENU 20.special = keywords 20.special { value.data = TSFE:id entryLevel = 1 mode = manual } 20.1 = TMENU 20.1.NO { ... } | |
mode | string | Which field in the pages-table to use for sorting. Possible values are: - SYS_LASTCHANGED: Is updated to the youngest tstamp of the records on the page when a page is generated. - manual or lastUpdated: Use the field "lastUpdated", which can be set manually in the page-record. - tstamp: Uses the "tstamp"-field of the pagerecord, which is set automatically when the record is changed. - crdate: Uses the "crdate"-field of the pagerecord. - starttime: Uses the starttime field. | SYS_LASTCHANGED |
entryLevel | int | Where in the rootline the search begins. See property entryLevel in the section "HMENU" above. | |
depth | int | (same as in section "special.updated") | 20 |
limit | int | (same as in section "special.updated") | 10 |
excludeNoSearchPages | boolean | (same as in section "special.updated") | |
begin | boolean | (same as in section "special.updated") | |
setKeywords | string/stdWrap | Lets you define the keywords manually by defining them as a comma-separated list. If this property is defined, it overrides the default, which is the keywords of the current page. | |
keywordsField | string | Defines the field in the pages-table in which to search for the keywords. Default is the field name "keyword". No check is done to see if the field you enter here exists, so enter an existing field, OK?! | keywords |
keywordsField.sourceField | string | Defines the field from the current page from which to take the keywords being matched. The default is "keyword". (Notice that ".keywordsField" is only setting the page-record field to search in !) | keywords |
[tsref:(cObject).HMENU.special.keywords]
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).
Property: | Data type: | Description: | Default: |
---|---|---|---|
value | comma list of sys_language uids/stdWrap | The number of elements in this list determines the number of menu items. | |
normalWhenNoLanguage | boolean | If set to 1 the button for a language will ve rendered as a non-disabled button even if no translation is found for the language. |
[tsref:(cObject).HMENU.special.language]
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
5 = IMAGE
5.file = typo3/sysext/cms/tslib/media/flags/flag_uk.gif || typo3/sysext/cms/tslib/media/flags/flag_fr.gif || typo3/sysext/cms/tslib/media/flags/flag_es.gif
5.offset = 2,2
}
lib.langMenu.1.ACT < lib.langMenu.1.NO
lib.langMenu.1.ACT = 1
lib.langMenu.1.ACT.backColor = black
lib.langMenu.1.USERDEF1 < lib.langMenu.1.NO
lib.langMenu.1.USERDEF1 = 1
lib.langMenu.1.USERDEF1.5.file = typo3/sysext/cms/tslib/media/flags/flag_uk_d.gif || typo3/sysext/cms/tslib/media/flags/flag_fr_d.gif || typo3/sysext/cms/tslib/media/flags/flag_es_d.gif
lib.langMenu.1.USERDEF1.noLink = 1
Lets you write your own little PHP-script that generates the array of menu items.
Property: | Data type: | Description: | Default: |
---|---|---|---|
file | resource | Filename of the php-file to include. (Just like cObject PHP_SCRIPT) | |
[any other key] | Your own variables to your script. They are all accessible in the array $conf in your script. |
[tsref:(cObject).HMENU.special.userdefined]
You must populate an array called $menuItemsArray with page-records of the menu items you want to be in the menu.
It works 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.
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]
By default the HMENU object is designed to create menus from pages in TYPO3. Such pages are represented by their page-record contents. Usually the "title" field is used for the title and the "uid" field is used to create a link to that page in the menu.
However the HMENU and sub-menu objects are so powerful that it would be very useful to use these objects for creating menus of links which does not relate to pages in TYPO3 by their ids. This could be a menu reflecting a menu structure of a plugin where each link might link to the same page id in TYPO3 but where the difference would be in some parameter value.
This can be done easily with the special-type "userdefined" (see table above) where you can return an array of menu items custom-built in a PHP-script you write.
First, this listing creates a menu in three levels where the first two are graphical items:
script_ended = 0; function jumpToUrl(URL) { document.location = URL; } 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: }
The menu looks like this on a web page:
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.
Creates a standard-table where you can define the content of the the various cells.
Property: | Data type: | Description: | Default: |
---|---|---|---|
offset | x,y /stdWrap | Offset from upper left corner. | 0,0 |
tm | ->CARRAY +TDParams /stdWrap | TopMenu The default value of TDParams is: valign="top". stdWrap is available for the property TDParams. | |
lm | ->CARRAY +TDParams /stdWrap | LeftMenu The default value of TDParams is: valign="top". stdWrap is available for the property TDParams. | |
rm | ->CARRAY +TDParams /stdWrap | RightMenu The default value of TDParams is: valign="top". stdWrap is available for the property TDParams. | |
bm | ->CARRAY +TDParams /stdWrap | BottomMenu The default value of TDParams is: valign="top". stdWrap is available for the property TDParams. | |
c | ->CARRAY +TDParams /stdWrap | Content-cell The default value of TDParams is: valign="top". stdWrap is available for the property TDParams. | |
cMargins | margins /stdWrap | Distance around the content-cell "c". | 0,0,0,0 |
cWidth | pixels /stdWrap | Width of the content-cell "c". | |
tableParams | <TABLE>-params /stdWrap | Attributes of the table tag. | border="0" cellspacing="0" cellpadding="0" |
stdWrap | ->stdWrap |
[tsref:(cObject).CTABLE]
Property: | Data type: | Description: | Default: |
---|---|---|---|
offset | x,y /stdWrap | Offset from upper left corner. Note: Actually the data type is "x,y,r,b,w,h" and stdWrap: x,y is the offset from upper left corner. r,b is the offset (margin) to right and bottom. w is the required width of the content field. h is the required height of the content field. All measures are in pixels. | |
1,2,3,4... | cObject | ||
tableParams | <TABLE>-params /stdWrap | Attributes of the table tag. | border="0" cellspacing="0" cellpadding="0" |
stdWrap | ->stdWrap |
[tsref:(cObject).OTABLE]
Property: | Data type: | Description: | Default: |
---|---|---|---|
tableParams | <TABLE>-params /stdWrap | Attributes of the table tag. | border="0" cellspacing="0" cellpadding="0" |
TDparams | <TD>-params /stdWrap | Attributes of the td tags. | valign="top" |
rows | integer (Range: 2-20) /stdWrap | The number of rows in the columns. | 2 |
totalWidth | integer /stdWrap | The total-width of the columns+gaps. | |
gapWidth | integer /stdWrap +optionSplit | Width of the gap between columns. 0 = no gap | |
gapBgCol | HTML-color /stdWrap +optionSplit | Background-color for the gap-tablecells. | |
gapLineThickness | integer /stdWrap +optionSplit | Thickness of the divider line in the gap between cells. 0 = no line | |
gapLineCol | HTML-color /stdWrap +optionSplit | Line color of the divider line. | black |
[column-number] 1,2,3,4... | cObject | This is the content-object for each column!! | |
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]
This object inserts a table tag, which you can use as a horizontal divider.
Property: | Data type: | Description: | Default: |
---|---|---|---|
lineThickness | integer /stdWrap | Range: 1-50 | 1 |
lineColor | HTML-color /stdWrap | The color of the ruler. | black |
spaceLeft | pixels /stdWrap | Space before the line (to the left). | |
spaceRight | pixels /stdWrap | Space after the line (to the right). | |
tableWidth | string /stdWrap | Width of the ruler ("width" attribute in a table). | 99% |
stdWrap | ->stdWrap |
[tsref:(cObject).HRULER]
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.
Property: | Data type: | Description: | Default: |
---|---|---|---|
text | ->CARRAY /stdWrap | Use this to import / generate the content, that should flow around the image block. | |
textPos | int /stdWrap | Text position: bit[0-2]: 000 = center, 001 = right, 010 = left bit[3-5]: 000 = over, 001 = under, 010 text 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 /stdWrap | List of images from ".imgPath". 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 | Maximum number of images. | |
imgStart | int /stdWrap | Start with image-number ".imgStart". | |
imgObjNum | imgObjNum +optionSplit | Here you define, which IMAGE-cObjects from the array "1,2,3,4..." in this 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 an 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 /stdWrap | Caption. | |
captionAlign | align /stdWrap | Caption alignment. | default = ".textPos" |
captionSplit | boolean | If this is set, the caption text is split by the character (or string) from ".token" , and every item is displayed under an image each in the image block. .token = (string /stdWrap) Character to split the caption elements (default is chr(10)) .cObject = cObject, used to fetch the caption for the split .stdWrap = stdWrap properties used to render the caption. | |
altText titleText | string /stdWrap | Default altText/titleText if no alternatives are provided by the ->IMAGE cObjects. If alttext is not specified, an empty alttext will be used. | |
emptyTitleHandling | string /stdWrap | Value can be "keepEmpty" to preserve an empty title attribute, or "useAlt" to use the alt attribute instead. | useAlt |
longdescURL | string /stdWrap | Default longdescURL if no alternatives are provided by the ->IMAGE cObjects "longdesc" attribute (URL pointing to document with extensive details about image). | |
border | boolean /stdWrap | If true, a border i generated around the images. | |
borderCol | HTML-color /stdWrap | Color of the border, if ".border" is set | black |
borderThick | pixels /stdWrap | Width of the border around the pictures | 1 |
cols | int /stdWrap | Columns | |
rows | int /stdWrap | Rows (higher priority thab "cols") | |
noRows | boolean /stdWrap | If set, the rows are not divided by a table-rows. Thus images are more nicely shown if the height differs a lot (normally the width is the same!) | |
noCols | boolean /stdWrap | If set, the columns are not made in the table. The images are all put in one row separated by a clear giffile to space them apart. If noRows is set, noCols will be unset. They cannot be set simultaneously. | |
colSpace | int /stdWrap | Space between columns. | |
rowSpace | int /stdWrap | Space between rows. | |
spaceBelowAbove | int /stdWrap | Pixel space between content an images when position of image is above or below text (but not in text) | |
tableStdWrap | ->stdWrap | This passes the final <table> code for the image block to the stdWrap function. | |
maxW | int /stdWrap | Maximum width of the image-table. This will scale images not in the right size! Takes the number of columns into account! NOTE: Works ONLY if IMAGE-obj is NOT GIFBUILDER! | |
maxWInText | int /stdWrap | Maximum width of the image-table, if the text is wrapped around the image-table (on the left or right side). This will scale images not in the right size! Takes the number of columns into account! NOTE: Works ONLY if IMAGE-obj is NOT GIFBUILDER! | 50% of maxW |
equalH | int /stdWrap | If this value is greater than zero, it will secure that images in a row has the same height. The width will be calculated. If the total width of the images raise above the "maxW"-value of the table the height for each image will be scaled down equally so that the images still have the same height but is within the limits of the totalWidth. Please note that this value will override the properties "width", "maxH", "maxW", "minW", "minH" of the IMAGE-objects generating the images. Furthermore it will override the "noRows"-property and generate a table with no columns instead! | |
colRelations | string /stdWrap | This value defines the width-relations of the images in the columns of IMGTEXT. The syntax is "[int] : [int] : [int] : ..." for each column. If there are more image columns than figures in this value, it's ignored. If the relation between two of these figures exceeds 10, this function is ignore. It works only fully if all images are downscaled by their maxW-definition. 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 e.g. 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 The default ImageMagick quality seems to be 75. This equals Photoshop quality 45. Images compressed with ImageMagick with the same visual quality as a Photoshop-compressed image seem to be largely 50% greater in size!! NOTE: Works ONLY if IMAGE-obj is NOT GIFBUILDER | |
image_effects | int /stdWrap | Adds these commands to the parameters for the scaling. This function has no effect if "image_compression" above is set to 1!! 1 => "-rotate 90", 2 => "-rotate 270", 3 => "-rotate 180", 10 => "-colorspace GRAY", 11 => "-sharpen 70", 20 => "-normalize", 23 => "-contrast", 25 => "-gamma 1.3", 26 => "-gamma 0.8" NOTE: Works ONLY if IMAGE-obj is NOT GIFBUILDER | |
image_frames | Array + .key /stdWrap | Frames: .key points to the frame used. ".image_frames.x" is imgResource-mask (".m")properties which will override to the [imgResource].m properties of the imageObjects. This is used to mask the images into a frame. See how it's done in the default configuration and IMGTEXT in the static_template-table. 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 } NOTE: This cancels the jpg-quality settings sent as ordinary ".params" to the imgResource. In addition the output of this operation will always be jpg or gif! NOTE: Works ONLY if IMAGE-obj is NOT GIFBUILDER | |
editIcons | string | (See stdWrap.editIcons) | |
noStretchAndMarginCells | boolean /stdWrap | If set (1), the cells used to add left and right margins plus stretch out the table will not be added. You will loose the ability to set margins for the object if entered "in text". So it's not recommended, but it has been requested by some people for reasons. | |
stdWrap | ->stdWrap |
[tsref:(cObject).IMGTEXT]
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>
}
This is a very flexible object whose rendering can vary depending on a given key. The principle is similar to that of the "switch" construct in PHP.
The "key" property is expected to match one of the values found in the "Array". If none is found, the "default" property will be used. Any string can be used as value in the "Array" except for those that match another property. So the forbidden values are: "setCurrent", "key", "stdWrap" and "if". And of course, "default" has a special meaning.
Property: | Data type: | Description: | Default: |
---|---|---|---|
setCurrent | string /stdWrap | Sets the "current"-value. | |
key | string /stdWrap | This is used to define the source of the value that will be matched against the values of "Array". It will generally not be a simple string, but use its stdWrap properties to retrieve a dynamic value from some specific source, typically a field of the current record (see example below). | default |
default | cObject | Defines the rendering for all values of "key" that don't match any of the values of "Array". | |
Array... | cObject | Defines the rendering for a number of values. | |
stdWrap | ->stdWrap | stdWrap around any object that was rendered no matter what the "key" value is. | |
if | ->if | If "if" returns false, nothing is returned. |
[tsref:(cObject).CASE]
This example chooses between two different renderings of some content depending on whether the field "layout" is "1" or 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 {
....
}
This provides a way to load the array $GLOBALS['TSFE']->register[] with values. It doesn't return anything! The usefulness 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.
Property: | Data type: | Description: | Default: |
---|---|---|---|
Array... [field name] | string /stdWrap | Example: (This sets "contentWidth", "label" and "head") page.27 = LOAD_REGISTER page.27 { contentWidth = 500 label.field = header head = some text head.wrap = <b> | </b> } |
[tsref:(cObject).LOAD_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.
This object provides a way to create forms
textarea:Label | [* = required][field name =] textarea[,cols,rows,"wrap= [eg. "OFF"]"] | [defaultdata] | Special evaluation configuration (see note below)
input:Label | [* = required][field name =] input[,size,max] | [defaultdata] | Special evaluation configuration (see note below)
password:Label | [* = required][field name =] input[,size,max] | [defaultdata]
file:Label | [* = required][field name (*1)=] file[,size]
check:Label | [* = required][field name =]check | [checked=1]
select:Label | [* = required][field name =]select[,size (int/"auto"), "m"=multiple] | label [=value] , ...
radio:Label | [* = required][field name =]radio | label [=value] , ...
hidden:|[field name =]hidden | value
submit:Label |[field name =]submit | Caption
reset: Label |[field name =]reset | Caption
label:Label | label | Label value
property:[Internal, see below]
------------------
This is an example, where "Brown" is the preselected item of a selector box:
Haircolor: | *haircolor=select| Blue=blue , Red=red , *Brown=brown
You can enter multiple items to be preselected by placing an asterisk in front of each preselected item.
This can be done with the following properties from the table below:
type, locationData, goodMess, badMess, emailMess
syntax:
|[property] =property | value
(*1) (field name for files)
In order for files to be attached the mails, you must use the field names:
attachment, attachment1, ... , attachment10
In order for the mails to be attached with the email address of the people that submits the mails, please use the field name "email", e.g:
Email: | *email=input |
By prefixing a "*" before the field name 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.
Your address: | address=textarea,40,10 | | EREG : You can only enter the characters A to Z : ^[a-zA-Z]*$
Your email: | *email=input | | EMAIL
Property: | Data type: | Description: | Default: |
---|---|---|---|
data | string /stdWrap | This is the data that sets up the form. See above. "||" can be used instead of line breaks | |
dataArray | [array of form elements] | This is an alternative way to define the form-fields. Instead of using the syntax with vertical separator bars suggested by the .data property, you can define the elements in regular TypoScript style arrays. .dataArray is added to the input in .data if any. Every entry in the dataArray is numeric and has three main properties, label, type, value and required. All of them have stdWrap properties. There is an alternative property to .value, which is .valueArray. This is also an array in the same style with numeric entries which has properties label, value and selected. All three of these properties have stdWrap properties. 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 } This is the same as this line in the .data property: Name: | *name=input | [Enter name] Eyecolor: | eyecolor=select | Blue=1, *Red=2 | submit=submit | 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 } Or translating the form to danish (setting config.language to 'dk'): 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 } | |
radioWrap | ->stdWrap | Wraps the labels for radio buttons. | |
radioWrap.accessibilityWrap | wrap /stdWrap | Defines how radio buttons are wrapped when accessibility mode is turned on (see below "accessibility" property). | <fieldset###RADIO_FIELD_ID###><legend>###RADIO_GROUP_LABEL###</legend>|</fieldset> |
radioInputWrap | ->stdWrap | Wraps the input element and label of a radio button. | |
type | integer, string | Type (action="" of the form): Integer: this is regarded to be a page in TYPO3 String: this is regarded to be a normal URL (e.g. "formmail.php" or "fe_tce_db.php") Empty: the current page is chosen. NOTE: If type is integer/empty the form will be submitted to a page in TYPO3 and if this page has a value for target/no_cache, then this will be used instead of the default target/no_cache below. NOTE: If the redirect-value is set, the redirect-target overrides the target set by the action-url NOTE: May be overridden by the property override feature of the formdata (see above) | |
target | target /stdWrap | Default target of the form. | |
method | form-method /stdWrap | Example: GET | POST |
no_cache | string /stdWrap | Default no_cache-option. | |
noValueInsert | boolean /stdWrap | By default values that are submitted to the same page (and thereby same form, e.g. at search forms) are re-inserted in the form instead of any default-data that might be set up. This, however, applies ONLY if the "no_cache=1" is set! (a page being cached may not include user-specific defaults in the fields of course...) If you set this flag, "noValueInsert", the content will always be the default content. | |
compensateFieldWidth | double /stdWrap | Overriding option to the config-value of the same name. See "CONFIG" above. | |
locationData | boolean / string /stdWrap | If this value is true, then a hidden-field called "locationData" is added to the form. This field will be loaded with a value like this: [page id]:[current record table]:[current record id] For example, if a formfield is inserted on page with uid = "100", as a page-content item from the table "tt_content" with id "120", then the value would be "100:tt_content:120". The value is use by eg. the cObject SEARCHRESULT. If the value $GLOBALS['HTTP_POST_VARS']['locationData'] is detected here, the search is done as if it was performed on this page! This is very useful if you want a search functionality implemented on a page with the "stype" field set to "L1" which means that the search is carried out from the first level in the rootline. Suppose you want the search to submit to a dedicated search page where ever. This page will then know - because of locationData - that the search was submitted from another place on the website. If "locationData" is not only true but also set to "HTTP_POST_VARS" then the value will insert the content of $GLOBALS['HTTP_POST_VARS']['locationData'] instead of the true location data of the page. This should be done with search-fields as this will carry the initial searching start point with. NOTE: May be overridden by the property override feature of the formdata (see above) | |
redirect | string /stdWrap | URL to redirect to (generates the hidden field "redirect") Integer: this is regarded to be a page in TYPO3 String: this is regarded to be a normal url Empty; the current page is chosen. NOTE: If this value is set, the target of this overrides the target of the "type". | |
recipient | (list of) string /stdWrap | Email recipient of the formmail content (generates the hiddenfield "recipient") | No email |
goodMess | string /stdWrap | Message for the form evaluation function in case of correctly filled form. NOTE: May be overridden by the property override feature of the formdata (see above). | No message |
badMess | string /stdWrap | Message for the form evaluation in case of missing required fields. This message is shown above the list of fields. NOTE: May be overridden by the property override feature of the formdata (see above). | No message |
emailMess | string /stdWrap | Message if a field evaluated to be an email address did not validate. NOTE: May be overridden by the property override feature of the formdata (see above). | |
image | ->IMAGE (cObject) | If this is a valid image the submit button is rendered as this image!! NOTE: CurrentValue is set to the caption-label before generating the image. | |
layout | string | This defines how the label and the field are placed towards each other. This property is mandatory; you must set it! Otherwise the form will not be rendered. Example: This substitutes the marker "###FIELD###" with the field data and the marker "###LABEL###' with label data. layout = <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 /stdWrap | Defines if required-fields should be checked and marked up. | |
REQ.fieldWrap | ->stdWrap | Field: Wraps the fields, but for required fields | the "fieldWrap"-property |
REQ.labelWrap | ->stdWrap | Labels: Wraps the label, but for required fields | the "labelWrap"-property |
REQ.layout | string /stdWrap | The same as "layout" above, but for required fields | the "layout"-property |
COMMENT.layout | string /stdWrap | Alternative layout for comments. | the "layout"-property |
CHECK.layout | string /stdWrap | Alternative layout for checkboxes | the "layout"-property |
RADIO.layout | string /stdWrap | Alternative layout for radio buttons | the "layout"-property |
LABEL.layout | string /stdWrap | Alternative layout for label types | the "layout"-property |
stdWrap | ->stdWrap | Wraps the whole form (before form tag 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". Available sub-property: stdWrap, see ->stdWrap. | |
params | form-element tag parameters /stdWrap | Extra parameters to form elements. 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. stdWrap is available for the sub-properties, e.g. params.tagname. | |
wrapFieldName | wrap /stdWrap | This wraps the field names before they are applied to the form-field tags. Example: If value is tx_myextension[input][ | ] then the field name "email" would be wrapped to this value: tx_myextension[input][email] | |
noWrapAttr | boolean /stdWrap | 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 /stdWrap | If set, the <form> tags and the form content will be returned in an array as separate elements including other practical values. This mode is for use in extensions where the array return value can be more useful. | |
accessibility | boolean /stdWrap | If set, then the form will be compliant with accessibility guidelines (XHTML compliant). This includes:
Notice: In TYPO3 4.0 and later, CSS Styled Content is configured to produce accessible forms by default. | |
formName | string /stdWrap | An alternative name for this form. Default will be a unique (random) hash. <form name="..."> | |
fieldPrefix | string /stdWrap | 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 /stdWrap | The IDs generated for all elements in a form are md5 hashes from the field name. Setting this to true will disable this behavior and use a cleaned field name, prefixed with the form name as the ID, instead. This can be useful to style specifically named fields with CSS. |
[tsref:(cObject).FORM]
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]
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
| auto_respond_msg=hidden| Hello / This is an automatic response. //We have received your mail.
| from_name=hidden | Website XY
| from_email=hidden | noreply@website.com
| organization=hidden | Organization XY
| redirect=hidden | 16
| priority=hidden | 5
| tv=hidden | 0
"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 field name 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 an auto-responder 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.
"organization": With this option you can set the mail header organization 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".
Search words are loaded into the register in a form ready for linking to pages:
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)
Property: | Data type: | Description: | Default: |
---|---|---|---|
allowedCols | string | List (separated by ":") of allowed table-cols. Example: pages.title:tt_content.bodytext | |
layout | string | This defines how the search content is shown. 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 search result. This is the code substituting the "###NEXT###"-mark | |
prev | cObject | This cObject will be wrapped by a link to the prev search result. This is the code substituting the "###PREV###"-mark | |
target | target /stdWrap | target til next/prev links! | |
range | integer /stdWrap | The number of results at a time! | 20 |
renderObj | cObject | The cObject to render the search results $cObj->data array is set to the resulting record from the search. Please note, that in all fields are named [tablename]_[fieldnam]. Thus the page title is in the field "pages_title". Apart from this, these fields from the pages-table are also present: uid | |
renderWrap | wrap /stdWrap | ||
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 /stdWrap | If this is set, the result is NOT sorted after lastUpdated, tstamp for the pages-table. | |
wrap | wrap /stdWrap | Wrap the whole content... | |
stdWrap | ->stdWrap | Wrap the whole content... | |
addExtUrlsAndShortCuts | boolean | If set, then the doktypes 3 and 4 (External URLS and Shortcuts) are added 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 be one occurrence of a tt_content element on an External URL / Shortcut page for them to show up. | |
languageField.[2nd table] | string | Setting a field name to filter language on. This works like the "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 ":". E.g.: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:
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
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.
In this case "pagecontent" is chosen as the fields to search. That includes tt_content.header, tt_content.bodytext and tt_content.imagecaption.
Prefixed to these queries is this:
SELECT pages.title AS pages_title, pages.subtitle AS pages_subtitle, pages.keywords AS pages_keywords, pages.description AS pages_description, pages.uid, tt_content.header AS tt_content_header, tt_content.bodytext AS tt_content_bodytext, tt_content.imagecaption AS tt_content_imagecaptionFROM pages, tt_contentWHERE(tt_content.pid=pages.uid) AND (pages.uid IN (2,5,6,20,21,22,29,30,31,3,4,8,9,16,1) AND pages.doktype in (1,2,5) AND pages.no_search=0 AND NOT tt_content.deleted AND NOT tt_content.hidden AND (tt_content.starttime<=985792797) AND (tt_content.endtime=0 OR tt_content.endtime>985792797) AND tt_content.fe_group IN (0,-1) AND NOT pages.deleted AND NOT pages.hidden AND (pages.starttime<=985792797) AND (pages.endtime=0 OR pages.endtime>985792797) AND pages.fe_group IN (0,-1)) ...
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.
... 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
... 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
... 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
... 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.
This calls either a PHP-function or a method in a class. This is very useful if you want to incorporate you own data processing or content.
Basically this is a userdefined cObject, because it's just a call to a function or method you control!
An important thing to know is that if you call a method in a class (which is of course instantiated as an object) the internal variable 'cObj' of that class is set with a reference to the parent cObj. See the file typo3/sysext/cms/tslib/media/scripts/example_callfunction.php for an example of how this may be useful for you. Basically it offers you an API of functions which are more or less relevant for you. Refer to the appendix "PHP include scripts" at the end of this document.
If you create this object as USER_INT, it'll be rendered non-cached, outside the main page-rendering.
Property: | Data type: | Description: | Default: |
---|---|---|---|
userFunc | function name | The name of the function. If you specify the name with a '->' in, it's interpreted as a call to a method in a class. Two parameters are sent: A content variable (which is empty in this case, but not when used from stdWrap function .postUserFunc and .preUserFunc) and the second parameter is an array with the properties of this cObject if any. Example: This TypoScript will display all content element headers of a page in reversed order. Please take a look at typo3/sysext/cms/tslib/media/scripts/example_callfunction.php! page = PAGE page.typeNum=0 includeLibs.something = typo3/sysext/cms/tslib/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 /stdWrap | 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. |
[tsref:(cObject).USER/(cObject).USER_INT]
With this cObject you can define a template (e.g. an HTML file) which should be used as a basis for your whole website. Inside the template file you can define markers, which will later be replaced with dynamic content by TYPO3.
Property: | Data type: | Description: | Default: |
---|---|---|---|
template | cObject | This must be loaded with the template-code. If not, the object returns nothing. Example: page.10 { template = FILE template.file = fileadmin/template.html } This will use the file fileadmin/template.html as template for your website. | |
subparts | Array... of cObject | This is an array of subpart-markers (case-sensitive). 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: In the template there is the subpart "HELLO": <!-- start of subpart ###HELLO### --> This is the HTML-code, that will be loaded in the register and will be replaced with the result... <!-- end ###HELLO### --> The following TypoScript code now replaces the subpart "HELLO" with the text given in "value": page.10.subparts { HELLO = TEXT HELLO.value = En subpart er blevet erstattet!! } NOTE: Before the content-objects of each subpart are 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 (e.g. 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/ } In this 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 cObject | This is an array of marks-markers (case-sensitive). A mark is defined by one marker 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.) Example: In the template: <div id="copyright"> © ###DATE### </div> The following TypoScript code now dynamically replaces the marker "DATE" with the current year: page.10.marks { DATE = TEXT DATE { data = date : U strftime = %Y } Marks are substituted by a str_replace-function. The subparts loaded in the register are also available to the cObjects of markers (only if .nonCachedSubst is not set!). | |
wraps | Array... of cObject | This is an array of wraps-markers (case-sensitive). This is shown best by an example: Example: In the template there is the subpart "MYLINK": This is <!--###MYLINK###-->a link to my<!--###MYLINK###--> page! With the following TypoScript code the subpart will be substituted by the wrap which is the content returned by the MYLINK cObject. page.10.wraps { MYLINK = TEXT MYLINK.value = <a href="#"> | </a> } | |
workOnSubpart | string /stdWrap | This is an optional definition of a subpart, that we decide to work on. In other words; if you define this value that subpart is extracted from the template and is the basis for this whole template object. | |
markerWrap | wrap /stdWrap | This is the wrap the markers are wrapped with. The default value is ### | ### resulting in the markers to be presented as ###[marker_key]###. Any whitespace around the wrap-items is stripped before they are set around the marker_key. | ### | ### |
substMarksSeparately | boolean /stdWrap | If set, then marks are substituted in the content AFTER the substitution of subparts and wraps. Normally marks are not substituted inside of subparts and wraps when you are using the default cached mode of the TEMPLATE cObject. That is a problem if you have marks inside of subparts! But setting this flag will make the marker-substitution a non-cached, subsequent process. Another solution is to turn of caching, see below. | |
nonCachedSubst | boolean /stdWrap | If set, then the substitution mode of this cObject is totally different. Normally the raw template is read and divided into the sections denoted by the marks, subparts and wraps keys. The good thing is high speed, because this "pre-parsed" template is cached. The bad thing is that templates that depend on incremental substitution (where the order of substitution is important) will not work so well. By setting this flag, markers are first substituted by str_replace in the template - one by one. Then the subparts are substituted one by one. And finally the wraps one by one. Obviously you loose the ability to refer to other parts in the template with the register-keys as described above. | |
stdWrap | ->stdWrap |
[tsref:(cObject).TEMPLATE]
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
}
In this example a template named test.tmpl is loaded and used.
The TypoScript object FLUIDTEMPLATE works in a similar way to the regular "marker"-based TEMPLATE object. However, it does not use markers or subparts, but allows Fluid-style variables with curly braces.
Note
The extensions "fluid" and "extbase" need to be installed for this to work.
Property: | Data type: | Description: | Default: |
---|---|---|---|
file | string /stdWrap | The fluid template file. | |
layoutRootPath | filepath /stdWrap | Sets a specific layout path; usually it is Layouts/ underneath the template file. | |
partialRootPath | filepath /stdWrap | Sets a specific partials path; usually it is Partials/ underneath the template file. | |
format | keyword /stdWrap | Sets the format of the current request. | html |
extbase.pluginName | string /stdWrap | Sets variables for initializing extbase. | |
extbase.controllerExtensionName | string /stdWrap | Sets the extension name of the controller. | |
extbase.controllerName | string /stdWrap | Sets the name of the controller. | |
extbase.controllerActionName | string /stdWrap | Sets the name of the action. | |
variables | Array... of cObjects | Sets variables that should be available in the fluid template. The keys are the variable names in Fluid. Reserved variables are "data" and "current", which are filled automatically with the current data set. | |
stdWrap | ->stdWrap |
[tsref:(cObject).FLUIDTEMPLATE]
This element will insert a multimedia file. Text files will be output directly; for Java, Flash, Audio and Video files an embed tag will be used.
Property: | Data type: | Description: | Default: |
---|---|---|---|
file | resource /stdWrap | The multimedia file. Possible file types are: txt, html, htm: Will be inserted directly, of the following properties only ".stdWrap" can be used. class: Java-applet. swf: Flash animation. swa, dcr: ShockWave Animation. au, wav, mp3: Sound. avi, mov, asf, mpg, wmv: Movies (AVI, QuickTime, MPEG4). | |
params | string /stdWrap | These are parameters for the multimedia-objects. Use this to enter stuff like autostart, type, width, height and so on. For each file type several parameters make sense. For an incomplete list see below this table. Example: params ( type = application/x-shockwave-flash width = 200 height = 300 ) This will generate a tag like <embed .... type="application/x-shockwave-flash" width="200" height="300"> For parameters which are set by default (see tables below) an empty string will remove the parameter from the embed-tag. Example: params ( height = ) Note: If you set a width or a height here, this will overwrite the width or the height which have been set using ".width" and ".height". | |
width | integer /stdWrap | Width attribute of the embed tag. Not used for txt, html, htm and sound files. | 200 |
height | integer /stdWrap | Height attribute of the embed tag. Not used for txt, html, htm and sound files. | 200 |
stdWrap | ->stdWrap |
[tsref:(cObject).MULTIMEDIA]
Parameter: | Description: | Default: |
---|---|---|
width | Width of the controls. If not set, the browser defaults to 200. | |
height | Height of the controls. If not set, the browser defaults to 16. | |
loop | Repeat the sound, when playing finished. Set to true or false. | |
autostart | Automatically start the sound. Set to true or false. |
Parameter: | Description: | Default: |
---|---|---|
width | Width of the movie. | 200 |
height | Height of the movie. | 200 |
autostart | Automatically start the video. Set to true or false. Note: Not for "mov", there the parameter is called "autostart". See example below. |
Parameter: | Description: | Default: |
---|---|---|
width | Width of the object. If not set, the browser defaults to approx. 200. | 200 |
height | Height of the object. If not set, the browser defaults to approx. 200. | 200 |
quality | Quality of the video. | high |
params (
width = 256
height = 208
autoplay = true
controller = true
loop = false
pluginspage = http://www.apple.com/quicktime/
)
With this element you can insert a SVG. You can use XML data directly or reference a file. A flash fallback will be used for browsers which do not have native SVG support, so that it also works in e.g. IE 6/7/8.
Property: | Data type: | Description: | Default: |
---|---|---|---|
width | integer /stdWrap | Width of the SVG. | 600 |
height | integer /stdWrap | Height of the SVG. | 400 |
src | file resource /stdWrap | SVG file resource. Example: src = fileadmin/svg/tiger.svg | |
value | XML /stdWrap | Raw XML data for the SVG. Will be ignored, if "src" is defined. | |
noscript | string /stdWrap | Output, if SVG output is not possible. | |
stdWrap | ->stdWrap |
[tsref:(cObject).SVG]
10 = SVG
10 {
width = 600
height = 600
value (
<rect x="100" y="100" width="500" height="200" fill="white" stroke="black" stroke-width="5px"/>
<line x1="0" y1="200" x2="700" y2="200" stroke="red" stroke-width="20px"/>
<polygon points="185 0 125 25 185 100" transform="rotate(135 125 25)" />
<circle cx="190" cy="150" r="40" stroke="black" stroke-width="2" fill="yellow"/>
)
noscript.cObject = TEXT
noscript.cObject.value = No SVG rendering possible, please use a browser.
}
This example will show some geometric forms.
This content object is inserted only if a backend user is logged in, a FE-editing extension is installed and loaded. What gets displayed exactly may depend on which FE-editing extension is used. The reference below is related to the "feedit" system extension. In such a case the EDITPANEL also requires that the Admin Panel be displayed (config.admPanel = 1) and that user has checked the "Display Edit Icons" option. Whenever the edit panel is inserted, page caching is disabled.
The edit panel inserts icons for moving, editing, deleting, hiding and creating records.
In conjunction with css_styled_content, an EDITPANEL will appear for each content element on the page. It is also possible to insert EDITPANEL in the template, using TypoScript.
page = PAGE
page.10 = EDITPANEL
page.10 {
...
}
In such a case, there's nothing to edit in the FE, but the panel can be used to create new records, for example.
Note
The extension "feedit" needs to be installed for this to work.
Property: | Data type: | Description: | Default: |
---|---|---|---|
label | string /stdWrap | Title for the panel. You can insert the record title with %s Example: label = 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 page records 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 /stdWrap | Wraps the edit panel | |
outerWrap | wrap /stdWrap | Wraps the whole edit panel including the black line (if configured) | |
printBeforeContent | boolean | Normally the edit panel is displayed below the content element it belongs to. If this option is set, the panel is printed in front of the according element. Example: tt_content.stdWrap.editPanel.printBeforeContent = 1 This displays the edit panels in front of the according elements, if you use css_styled_content. | 0 |
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.innerWrap previewBorder.outerWrap previewBorder.color | wrap / HTML color | innerWrap wraps the content elements (including the icons) inside the preview border (an HTML table). outerWrap wraps the whole content element including the border. color denotes the color of the border. | |
stdWrap | ->stdWrap |
[tsref:(cObject).EDITPANEL]