Login / Status
developer.Resource
Home . Documentation . Document Library
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

1.7. Content Objects (cObject)

PHP-information:

The content objects (cObjects) are primarily controlled by the PHP-script "typo3/sysext/cms/tslib/content.php". The PHP-class is named "tslib_cObj" and often this is also the variable-name of the objects ($cObj)

The $cObj in PHP has an array, $this->data, which holds records of various kind. See data type "getText".

This record is normally "loaded" with the record from a table depending on the situation. Say if your 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.

IMPORTANT NOTE :

When dealing with "cObjects", you're allowed to use a special syntax in order to reuse cObjects without actually creating a copy. This has the advantage of minimizing the size of the cached template. But on the other hand it doesn't give you the flexibility of overriding values.

This example will show you how it works:

#
# Temporary objects are defined:
#
lib.stdheader = COA
lib.stdheader {
  stdWrap.wrapAlign.field = header_position
  stdWrap.typolink.parameter.field = header_link
  stdWrap.fieldRequired = header
  1 = TEXT
  1.current = 1
  1.fontTag = {$content.wrap.header1}
  stdWrap.space = {$content.headerSpace}
}
# 
# CType: header
#
tt_content.header = COA
tt_content.header {
  10 < lib.stdheader
  10.stdWrap.space >
  20 = TEXT
  20.field = subheader
  20.fontTag = {$content.wrap.subheader1}
}
#
# CType: bullet
#
tt_content.bullets = COA
tt_content.bullets {
  10 = < lib.stdheader
  20 < styles.content.bulletlist_gr
}

Comment: First lib.stdheader is defined. This is (and must be) a cObject ! (in this case, COA).

Now lib.stdheader is copied to tt_content.header.10 with the "<" operator. This means that an actual copy of lib.stdheader is created at parsetime.

But this is not the case with tt_content.bullets.10. Here lib.stdheader is just pointed to and lib.stdheader will be used  as the cObject at runtime.

The reason why lib.stdheader was copied in the first case is the fact that it's needed to unset ".stdWrap.space" inside the cObject ("10.stdWrap.space >"). This could NOT be done in the second case where only a pointer is created.

NOTE:

If lib.stdheader was temp.stdheader instead, the pointer would not work! This is due to the fact that the runtime-reference would find nothing in "temp." as this is unset before the template is stored in cache!

This goes for "temp." and "styles." (see the toplevel object definition elsewhere)

Overriding values anyway:

Although you can not override values TypoScript-style (using the operators and all) the properties of the object which has the reference will be merged with the config of the reference.

Example:

page.10 = TEXT
page.10.value = kasper
page.10.case = upper
page.20 = < page.10
page.20.case = lower

page.20.value >

page.20.field = pages

The result is this config:

Notice that .value was not cleared (the red line), because it's simply two arrays which are joined:

So hence the red line in the above example is useless.

HTML

Property:

Data type:

Description:

Default:

value

HTML /stdWrap

Raw HTML-code.

[tsref:(cObject).HTML]

Example:

10 = HTML
10.value = This is a text in uppercase
10.value.case = upper

Example:

10 = HTML
10.value.field = bodytext
10.value.br = 1

TEXT

TEXT is very similar to the cObject "HTML". But the stdWrap is on the very rootlevel of the object. This is non-standard. Check the example.

Property:

Data type:

Description:

Default:

value

value

text, wrap with stdWrap properties

(stdWrap properties...)

[tsref:(cObject).TEXT]

Example:

10 = TEXT
10.value = This is a text in uppercase
10.case = upper

Example:

10 = TEXT
10.field = bodytext
10.br = 1

COBJ_ARRAY (COA, COA_INT)

This cObject has the alias COA. You can use 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 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

includeLibs

list of resource

(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]

Example:

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>
}

FILE

PHP-function: $this->fileResource()

Property:

Data type:

Description:

Default:

file

resource

If the resource is jpg,gif,jpeg,png the image is inserted as an image-tag. Al other formats is read and inserted into the HTML-code.

The maximum filesize of documents to be read is set to 1024 kb internally!

linkWrap

linkWrap

(before ".wrap")

wrap

wrap

altText

titleText

string /stdWrap

For <img> output only!

If no alttext is specified, it will use an empty alttext

emptyTitleHandling

string

Value can be “keepEmpty” to preserve an empty title attribute, or “useAlt” 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]

Example:

In this example a page is defined, but the content between the body-tags comes directly from the file "gs.html":

page.10 = FILE
page.10.file = fileadmin/gs/gs.html

IMAGE

PHP-function: $cObj->cImage();

The array $GLOBALS["TSFE"]->lastImageInfo is set with the info-array of the returning image (if any) and contains width, height and so on.

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 alttext is specified, it will use an empty alttext

("alttext" is the old spelling of this attribute. It will be used only if "altText" does not specify a value or properties)

emptyTitleHandling

string

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

(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

[tsref:(cObject).IMAGE]

Example:

    10 = IMAGE 
    10.file = toplogo*.gif
    10.params = hspace=5
    10.wrap = |<BR>

IMG_RESOURCE

Returns only the image-reference, possibly wrapped with stdWrap. May be used for putting background images in tables or table-rows or to import a image in your own include-scripts.

The array $GLOBALS["TSFE"]->lastImgResourceInfo is set with the info-array of the resulting image resource (if any) and contains width, height and so on.

Property:

Data type:

Description:

Default:

file

imgResource

stdWrap

->stdWrap

[tsref:(cObject).IMG_RESOURCE]

CLEARGIF

Inserts a transparent gif-file.

Property:

Data type:

Description:

Default:

height

<img>-data:height /stdWrap

1

width

<img>-data:width /stdWrap

1

wrap

wrap

 | <BR>

[tsref:(cObject).CLEARGIF]

Example:

    20 = CLEARGIF
    20.height=20

CONTENT

This object is designed to generate content by making it possible to finely select records and rendering them.

The register-key SYS_LASTCHANGED is updated with the tstamp-field of the records selected which has a higher value than the current.

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

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): 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): 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): Change order of elements in collect mode. If set, elements of the current page will be on the bottom.

wrap

wrap

Wrap the whole content-story...

stdWrap

->stdWrap

[tsref:(cObject).CONTENT]

Example (of the CONTENT-obj):

  1 = CONTENT
  1.table = tt_content
  1.select {
    pidInList = this
    orderBy = sorting
  }

Example (of record-renderObj's):

// 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 use, else default
tt_content.bullets.subTypeField = layout
tt_content.bullets.default {
  .....
}
tt_content.bullets.1 {
  .....
}
tt_content.bullets.2 {
  .....
}
// This is what happens if the typeField-value does not match any of the above
tt_content.default.default {
  .....
}

RECORDS

This object is meant for displaying lists of records from a variety of tables. Contrary to the CONTENT object, it does not allow for very fine selections of records (it has no “select” property)

The register-key SYS_LASTCHANGED is updated with the tstamp-field of the records selected which has a higher value than the current.

NOTE: Records with parent ids (pid's) for non-accessible pages (that is hidden, timed or access-protected pages) are normally not selected. Pages may be of any type, except recycler. Disable the check with the "dontCheckPid"-option.

Property:

Data type:

Description:

Default:

source

records-list /stdWrap

List of record-id's, optionally with prepended table-names.

Example:

tt_content_34, 45, tt_links_56

tables

list of tables

List of accepted tables. If any items in the ".source"-list is not prepended with a tablename, the first table in this list is assumed to be the table for such records.

Also tablenames configured in .conf is 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, 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

Normally a record cannot be selected, if it's parent page (pid) is not accessible for the website user. This option disables that check.

wrap

wrap

stdWrap

->stdWrap

[tsref:(cObject).RECORDS]

Example:

  20 = RECORDS
  20.source.field = records
  20.tables = tt_address
  20.conf.tt_address < tt_address.default

HMENU

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 separate table 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 int

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

[tsref:(cObject).HMENU]

Example:

temp.sidemenu = HMENU
temp.sidemenu.entryLevel = 1
temp.sidemenu.1 = TMENU
temp.sidemenu.1 {
  target = page
  NO.afterImg = media/bullets/dots2.gif |*||*| _
  NO.afterImgTagParams = hspace="4"
  NO.linkWrap = {$fontTag}
  NO.ATagBeforeWrap = 1
  ACT < .NO
  ACT = 1
  ACT.linkWrap = <b>{$fontTag}</b>
}

The .special property

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: Don't set .entryLevel for a HMENU when using this option! Also be aware that this selects pages for the first level in the menu. Submenus by menuPbjects 2+ will be created as usual.

special.directory

A HMENU of type special = directory lets you create a menu listing the subpages of one or more parent pages. The parent pages are defined in the property “.value”. It is usually used for sitemaps.

Mount pages are supported.

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]

special.list

A HMENU of type special = list lets you create a menu that lists the pages you define in the property “.value”.

Mount pages are supported.

Property:

Data type:

Description:

Default:

value

list of page ids /stdWrap

This will generate a menu with the two pages (uid=35 and uid=36) listed:

  20 = HMENU

  20.special = list

  20.special.value = 35, 56

If .value is not set, the default uid is the .entryLevel uid.

.entryLevel uid

[tsref:(cObject).HMENU.special.list]

special.updated

A HMENU with the property special = updated will create a menu of the most recently updated pages.

A note on ordering: The sorting menu is by default done in reverse order (desc) with the field specified by “mode”, but setting “alternativeSortingField” for the menu object (eg TMENU or GMENU, see later) will override that.

Mount pages are supported.

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=36) listed.

  20 = HMENU

  20.special = updated

  20.special.value = 35, 56

mode

string

The field in the database that contains the information about the last update. The following values are possible:

- SYS_LASTCHANGED (default)

- crdate

- tstamp  (is set automatically when the record is changed)

- lastUpdated  (set manually in the page-record)

- manual  (an alias for lastUpdated)

- starttime

Fields with empty values are generally not selected.

SYS_LASTCHANGED

depth

int

Defines the treedepth.

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 pagetrees 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 into special-menus.

[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=36) listed. Furthermore the field "tstamp" is used (default is SYS_LASTCHANGED) and the treedepth is 2 levels. Also there will be shown a maximum of 8 pages 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
  }
special.rootline

A HMENU with the property special = rootline creates a rootline menu (also known as “breadcrumb trail”) that could look like this:

Page level 1 > Page level 2 > Page level 3 > Current page

(For a description of “rootline” see further up in this document.)

Mount pages are supported.

Property:

Data type:

Description:

Default:

range

string /stdWrap

[begin-level] | [end-level] (same way as you reference the .entryLevel for 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 = rootlinetemp.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 subproperty. In the following example the links to pages on level 3 will have target=”page”, while all other levels will have target=”_top” through 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]

special.browse

Warning: Mount pages are not supported!

This kind of menu is built of items given by a list from the property ".item".

Ordering is by default done in reverse order (desc) with the field specified by “mode” , but setting “alternativeSortingField” for the menu object (eg GMENU, see later) will override that.

Property:

Data type:

Description:

Default:

value

int/stdWrap

Default is current page id. Seldomly you might want to override this value with another page-uid which will then act as the basepoint for the menu and the predefined items.

current page id

items

list of itemnames seperated by “|”

Each element in the list (separated by "|") is either a reserved item name (see list) with a predefined function, or a userdefined name which you can assign a link to any page. Note that the current page cannot be the root-page of a site.

Reserved itemnames:

next / prev : links to next page / previous page. Next and previous pages are from the same "pid" as the current page id (or "value") - that is the next item in a menu with the current page. Also referred to as current level.

If ".prevnextToSection" is set then next/prev will link to the first page of next section / last page of previous section.

nextsection / prevsection : links to next section / previous section. A section is defined as the subpages of a page on the same level as the parent (pid) page of the current page. Will not work if parent page of current page is the root page of the site.

nextsection_last | prevsection_last: Where nextsection/prevsection links to the first page in a section, these links to the last pages. If there is only one page in the section that will be both first and last. Will not work if parent page of current page is the root page of the site.

first / last : First / Last page on current level. If there is only one page on the current level that page will be both first and last.

up : Links to the parent (pid) page of the current page. (up 1 level) Will always be available

index : Links to the parent of the parent page of the current page (up 2 levels). May not be available if that page is out of the rootline.

Examples:

If id=20 is 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

[itemnames].target

string

Optional/alternative target of the item

[itemnames].uid

int

(uid of page) - optional/alternative page-uid to link to

[itemnames].fields.[fieldname]

string

Override field "fieldname" in pagerecord

[tsref:(cObject).HMENU.special.browse]

special.keywords

Makes a menu of pages with one or more keywords also found on the current page.

Mount pages are supported.

Property:

Data type:

Description:

Default:

value

int/stdWrap

Page for which keywords to find similar pages

mode

string

Which field in the pages-table to use for sorting. Possible values are:

SYS_LASTCHANGED (which is updated when a page is generated to the youngest tstamp of the records on the page).

manual or lastUpdated will use the field "lastUpdated" (set manually in the page-record).

tstamp will use the "tstamp"-field of the pagerecord, which is set automatically when the record is changed.

crdate will use "crdate"-field of the pagerecord.

starttime will use the starttime field.

SYS_LAST_CHANGED

entryLevel

int

Where in the rootline the search begins.

Standard rootline syntax (-x to x)

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 commaseparated 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 fieldname “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]

special.language

Creates a language selector menu. Typically this is made as a menu with flags for each language a page is translated to and when the user clicks any element the same page id is hit but with a change to the “&L” parameter in the URL.

The “language” type will create menu items based on the current page record but with the language record for each language overlaid if available. The items all link to the current page id and only “&L” is changed.

Note on item states:

When “TSFE->sys_language_uid” matches the sys_language uid for an element the state is set to “ACT”, otherwise “NO”. However, if a page is not available due to the pages “Localization settings” (which can disable translations) or if no Alternative Page Language record was found (can be disabled with “.normalWhenNoLanguage”, see below)  the state is set to “USERDEF1” for non-active items and “USERDEF2” for active items. So in total there are four states to create designs for. It is recommended to disable the link on menu items rendered with “USERDEF1” and “USERDEF2” in this case since they are disabled exactly because a page in that language does not exist and might even issue an error if tried accessed (depending on site configuration).

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 = media/flags/flag_uk.gif  || media/flags/flag_fr.gif  || 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 = media/flags/flag_uk_d.gif  || media/flags/flag_fr_d.gif  || media/flags/flag_es_d.gif 
lib.langMenu.1.USERDEF1.noLink = 1
special.userdefined

Lets you write your own little PHP-script that generates the array of menuitems.

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 menuitems you want to be in the menu.

It goes like this:

$menuItemsArray[] = pageRow1;

$menuItemsArray[] = pageRow2;

$menuItemsArray[] = pageRow3;

...

A “pageRow” is a record from the table “pages” with all fields selected (SELECT * FROM...)

If you create fake page rows, make sure to add at least “title” and “uid” field values.

Notice:

If you work with mount-points you can set the MP param which should be set for the page by setting the internal field “_MP_PARAM” in the page-record (xxx-xxx).

Overriding URLs:

You can also use the internal field "_OVERRIDE_HREF" to set a custom href-value (eg. "http://www.typo3.org") which will in any case be used rather than a link to the page that the page otherwise might represent. If you use "_OVERRIDE_HREF" then "_OVERRIDE_TARGET" can be used to override the target value as well (See example below).

Other reserved keys:

“_ADD_GETVARS” can be used to add get parameters to the URL, eg. “&L=xxx”.

“_SAFE” can be used to protect the element to make sure it is not filtered out for any reason.

Creating submenus:

You can create submenus for the next level easily by just adding an array of menu items in the internal field "_SUB_MENU" (See example below).

Presetting element state

If you would like to preset an element to be recognized as a SPC, IFSUB, ACT, CUR or USR mode item, you can do so by specifying one of these values in the key “ITEM_STATE” of the page record. This setting will override the natural state-evaluation.

special.userfunction

Calls a user function/method in class which should (as with “userdefined” above) return an array with page records for the menu.

Property:

Data type:

Description:

Default:

userFunc

string

Name of the function

[tsref:(cObject).HMENU.special.userfunction]

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 easily done with the special-type "userdefined" (see table above) where you can return an array of menu items customly build 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 webpage:

The TypoScript code above generates this menu, but the items does not link straight to pages as usual. This is because the whole menu is generated from this array, which was returned from the function "menuMenuArray" called in TypoScript line 4+5

   1:     function makeMenuArray($content,$conf)    {
   2:         return array(
   3:             array(
   4:                 'title' => 'Contact',
   5:                 '_OVERRIDE_HREF' => 'index.php?id=10',
   6:                 '_SUB_MENU' => array(
   7:                     array(
   8:                         'title' => 'Offices',
   9:                         '_OVERRIDE_HREF' => 'index.php?id=11',
  10:                         '_OVERRIDE_TARGET' => '_top',
  11:                         'ITEM_STATE' => 'ACT',
  12:                         '_SUB_MENU' => array(
  13:                             array(
  14:                                 'title' => 'Copenhagen Office',
  15:                                 '_OVERRIDE_HREF' => 'index.php?id=11&officeId=cph',
  16:                             ),
  17:                             array(
  18:                                 'title' => 'Paris Office',
  19:                                 '_OVERRIDE_HREF' => 'index.php?id=11&officeId=paris',
  20:                             ),
  21:                             array(
  22:                                 'title' => 'New York Office',
  23:                                 '_OVERRIDE_HREF' => 'http://www.newyork-office.com',
  24:                                 '_OVERRIDE_TARGET' => '_blank',
  25:                             )
  26:                         )
  27:                     ),
  28:                     array(
  29:                         'title' => 'Form',
  30:                         '_OVERRIDE_HREF' => 'index.php?id=10&cmd=showform',
  31:                     ),
  32:                     array(
  33:                         'title' => 'Thank you',
  34:                         '_OVERRIDE_HREF' => 'index.php?id=10&cmd=thankyou',
  35:                     ),
  36:                 ),
  37:             ),
  38:             array(
  39:                 'title' => 'Products',
  40:                 '_OVERRIDE_HREF' => 'index.php?id=14',
  41:             )
  42:         );
  43:     }

Notice how the array contains "fake" page-records which has no uid field, only a "title" and "_OVERRIDE_HREF" as required and some other fields as it fits.

  1. 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.

  2. 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.

CTABLE

Creates a standard-table where you can define the content of the the various cells

Property:

Data type:

Description:

Default:

offset

x,y

Offset from upper left corner

0,0 = intet

tm

->CARRAY +TDParams

topMenu

lm

->CARRAY +TDParams

leftMenu

rm

->CARRAY +TDParams

rightMenu

bm

->CARRAY +TDParams

bottomMenu

c

->CARRAY +TDParams

content-cell

cMargins

margins

Distance around the content-cell "c"

0,0,0,0

cWidth

pixels

Width of the content-cell "c"

tableParams

<TABLE>-params

border=0 cellspacing=0 cellpadding=0

[tsref:(cObject).CTABLE]

Example:

page.10 = CTABLE
page.10 {
  offset = 5, 0
  tableParams = border=0 width=400
  cWidth=400
  c.1 = CONTENT
  c.1.table = tt_content
  c.1.select {
    pidInList = this
    orderBy = sorting
  }
  tm.10 < temp.sidemenu
  tm.TDParams = valign=top
}

OTABLE

Property:

Data type:

Description:

Default:

offset

x,y

Offset from upper left corner

Note:

Actually the datatype is “x,y,r,b,w,h”:

x,y is offset from upperleft corner

r,b is offset (margin) to right and bottom

w is the required width of the content field

h is the required height of the content field

All measures is in pixels.

1,2,3,4...

cObject

tableParams

<TABLE>-params

border=0 cellspacing=0 cellpadding=0

[tsref:(cObject).OTABLE]

Example:

top.100 = OTABLE
top.100.offset = 310,8
top.100.tableParams = border=0 cellpadding=0 cellspacing=0
top.100.1 < temp.topmenu

COLUMNS

Property:

Data type:

Description:

Default:

tableParams

<TABLE>-params

border=0 cellspacing=0 cellpadding=0

TDparams

<TD>-params

valign=top

rows

int (Range: 2-20)

The number of rows  in the columns.

2

totalWidth

int

The total-width of the columns+gaps

gapWidth

int /stdWrap

+optionSplit

Width of the gap between columns.

0 = no gap

gapBgCol

HTML-color /stdWrap

+optionSplit

background-color for the gap-tablecells

gapLineThickness

int /stdWrap

+optionSplit

lineThickness of the dividerline in the gap between cells

0 = no line

gapLineCol

HTML-color /stdWrap

+optionSplit

Line color

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]

HRULER

Property:

Data type:

Description:

Default:

lineThickness

int /stdWrap

Range: 1-50

1

lineColor

HTML-color

The color of the ruler.

black

spaceLeft

pixels

space before the line (to the left)

spaceRight

pixels

space after the line (to the right)

tableWidth

string

Width of the ruler (“width” attribute in a table)

99%

stdWrap

->stdWrap

 

[tsref:(cObject).HRULER]

IMGTEXT

This object is designed to align images and text. This is normally used to render text/picture records from the tt_content table.

The image(s) are placed in a table and the table is placed before, after or left/right relative to the text.

See code examples.

Property:

Data type:

Description:

Default:

text

->CARRAY /stdWrap

Use this to import / generate the content, that should flow around the imageblock.

textPos

int /stdWrap

Textposition:

bit[0-2]: 000 = centre, 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

max 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 a image-object. Starting with zero.

The image-object should not be of type GIFBUILDER!

Important:

"file.import.current = 1" fetches the name of the images!

caption

->CARRAY /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 no alttext is specified, it will use an empty alttext

emptyTitleHandling

string

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

Pixelsspace between content an images when position of image is above or belox text (but not in text)

tableStdWrap

->stdWrap

This passes the final <table> code for the image block to the stdWrap function.

maxW

int /stdWrap

max 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

max 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 imagecolumns 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 eg. 100, 200 and 300  pixels from left to right

1 : 2 : 3

image_compression

int /stdWrap

Image Compression:

0= Default

1= Don't change! (removes all parameters for the image_object!!)

(adds gif-extension and color-reduction command)

10= GIF/256

11= GIF/128

12= GIF/64

13= GIF/32

14= GIF/16

15= GIF/8

(adds jpg-extension and quality command)

20= IM: -quality 100

21= IM: -quality 90 <=> Photoshop 60     (JPG/Very High)

22= IM: -quality 80    (JPG/High)

23= IM: -quality 70

24= IM: -quality 60 <=> Photoshop 30   (JPG/Medium)

25= IM: -quality 50

26= IM: -quality 40  (JPG/Low)

27= IM: -quality 30 <=> Photoshop 10

28= IM: -quality 20   (JPG/Very Low)

(adds png-extension and color-reduction command)

30= PNG/256

31= PNG/128

32= PNG/64

33= PNG/32

34= PNG/16

35= PNG/8

39= PNG

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 seems 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 parameteres 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

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]

Example:

tt_content.textpic.default {
  5 = IMGTEXT
  5 {  
    text < tt_content.text.default
    imgList.field = image
    textPos.field = imageorient
    imgPath = uploads/pics/
    imgObjNum = 1
    1 {
       file.import.current = 1
       file.width.field = imagewidth
       imageLinkWrap = 1
       imageLinkWrap {
         bodyTag = <BODY bgColor=black>
         wrap = <A href="javascript:close();"> | </A>
         width = 800m
         height = 600m
         JSwindow = 1
         JSwindow.newWindow = 1
         JSwindow.expand = 17,20
       }
    }
    maxW = 450
    maxWInText = 300
    cols.field = imagecols
    border.field = imageborder
    caption {
      1 = TEXT
      1.field = imagecaption
      1.wrap = <font size="1"> |</font>
      1.wrap2 = {$cBodyTextWrap}
    }
    borderThick = 2
    colSpace = 10
    rowSpace = 10
    textMargin = 10
  }
  30 = HTML
  30.value = <br>
}

CASE

This provides something alike a switch-construct in PHP. The property "key" is supposed to equal the name of another property in the object (Array...) which is a cObject. If the property .[key] is defined, "default" will be used.

Strings is Array... can be anything except the reserved words "key", "default", "stdWrap", "if"

Property:

Data type:

Description:

Default:

setCurrent

string /stdWrap

Sets the "current"-value.

key

string /stdWrap

This is the

default

cObject

Array...

cObject

stdWrap

->stdWrap

if

->if

if "if" returns false nothing is returned

[tsref:(cObject).CASE]

Example:

This example chooses between two different renderings of some content depending on whether the field "layout" is "1" of not ("default"). The result is in either case wrapped with "|<BR>". If the field "header" turns out not to be set ("false") an empty string is returned anyway.

stuff = CASE
stuff.key.field = layout
stuff.if.isTrue.field = header
stuff.stdWrap.wrap = |<BR>
stuff.default = TEXT
stuff.default {
  ....
}
stuff.1 = TEXT
stuff.1 {
  ....
}

LOAD_REGISTER:

This provides a way to load the array $GLOBALS["TSFE"]->register[] with values. It doesn't return anything! The usefullness of this is, that some predefined configurations (like the page-content) can be used in various places but use different values as the values of the register can change during the page-rendering.

Property:

Data type:

Description:

Default:

Array...  

[fieldname]

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]

RESTORE_REGISTER

This unsets the latest changes in the register-array as set by LOAD_REGISTER.

Internally this works like a stack where the original register is saved when LOAD_REGISTER is called. Then a RESTORE_REGISTER cObject is called the last element is pulled of that stack the register is replaced with it.

RESTORE_REGISTER has no properties.

FORM

This object provides a way to create forms

textarea:Label | [* = required][fieldname =] textarea[,cols,rows,"wrap= [eg. "OFF"]"] | [defaultdata] | Special evaluation configuration (see note below)
input:Label | [* = required][fieldname =] input[,size,max] | [defaultdata] | Special evaluation configuration (see note below)
password:Label | [* = required][fieldname =] input[,size,max] | [defaultdata]
file:Label | [* = required][fieldname (*1)=] file[,size] 
check:Label | [* = required][fieldname =]check | [checked=1] 
select:Label | [* = required][fieldname =]select[,size (int/"auto"), "m"=multiple] | label [=value] , ...
radio:Label | [* = required][fieldname =]radio | label [=value] , ...
hidden:|[fieldname =]hidden | value
submit:Label |[fieldname =]submit | Caption
reset: Label |[fieldname =]reset | Caption
label:Label | label | Label value
property:[Internal, see below]

------------------

Preselected item with type "select" and "radio":

This is an example, where "Brown" is the preselected item of a selectorbox:

Haircolor: | *haircolor=select| Blue=blue , Red=red , *Brown=brown

You can enter multiple items to be preselected by placing a asterisk in front of each preselected item.

Property override:

This can be done with the following properties from the table below:

type, locationData, goodMess, badMess, emailMess

syntax:

|[property] =property | value

(*1) (fieldname for files)

In order for files to be attached the mails, you must use the fieldnames:

attachment, attachment1, ... , attachment10

Correct return-email:

In order for the mails to be attached with the email address of the people that submits the mails, please use the fieldname "email", eg:  Email: | *email=input |

Special evaluation

By prefixing a “*” before the fieldname of most types you can have the value of the field required. The check is done in JavaScript; It will only submit the form if this field is filled in.

Alternatively you can evaluate a field value against a regular expression or as an email address for certain types (textarea, password, input).

This is done by specifying the “Special evaluation configuration” for those types as part 4 in the configuration line (see examples above).

The special evaluation types are divided by a semicolon (“:”).

The first part defines the evaluation keyword. Current options are “EREG” (for regular expression) and “EMAIL” (for evaluation to an email address).

If the “EREG” keyword is specified the 2nd and 3rd parts are error message and regular expression respectively.

Examples:

Your address: | address=textarea,40,10 |  | EREG : You can enter only 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 linebreaks

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. 'label' and 'value' has 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. 'label' has 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 radiobuttons

radioWrap.accessibilityWrap

wrap

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>

type

int

Type (action="" of the form):

Integer: this is regarded to be a page in TYPO3

String: this is regarded to be a normal URL (eg. "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

Default target of the form.

method

form-method

Example:

GET

POST

no_cache

string

Default no_cache-option

noValueInsert

boolean

By default values that are submitted to the same page (and thereby same form, eg. at searchforms) 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

Overriding option to the config-value of the same name. See "CONFIG" above.

locationData

boolean / string

If this value is true, then a hidden-field called "locationData" is added to the form. This field wil 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 usefull 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 searchpage where ever. This page will then know - because of locationData - that the search was submittet 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 overriddes the target of the "type".

recipient

(list of) string /stdWrap

Email recipient of the formmail content (generates the hiddenfield "recipient")

No email

goodMess

string

Message for the formevaluation 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

Prefixed Message for the formevaluation 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

Message if a field evaluated to be an email adresse 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 submitbutton 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.

Example:

This substitutes the "###FIELD###" with the field data and the "###LABEL###' with labeldata.

<tr><td>###FIELD###</td><td> ###LABEL###</td></tr>

You can also use the marker ###COMMENT### which is ALSO the label value inserted, but wrapped in .commentWrap stdWrap-properties (see below)

fieldWrap

->stdWrap

Field: Wraps the fields

labelWrap

->stdWrap

Labels: Wraps the label

commentWrap

->stdWrap

Comments: Wrap for comments IF you use ###COMMENT###

REQ

boolean

Defines if required-fields should be checked and marked up

REQ.fieldWrap

->stdWrap

Field: Wraps the fields, but for reuired fields

the "fieldWrap"-property

REQ.labelWrap

->stdWrap

Labels: Wraps the label, but for reuired fields

the "labelWrap"-property

REQ.layout

string

The same as "layout" above, but for reuired fields

the "layout"-property

COMMENT.layout

string

Alternative layout for comments.

the "layout"-property

CHECK.layout

string

Alternative layout for checkboxes

the "layout"-property

RADIO.layout

string

Alternative layout for radiobuttons

the "layout"-property

LABEL.layout

string

Alternative layout for label types

the "layout"-property

stdWrap

->stdWrap

Wraps the hole form (before formtags is added)

hiddenFields

[array of cObject]

Used to set hiddenFields from TS.

Example:

hiddenFields.pid = TEXT

hiddenFields.pid.value = 2

This makes a hidden-field with the name “pid” and value “2”.

params

form-element tag parameters

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.

wrapFieldName

wrap

This wraps  the fieldnames before they are applied to the form-field tags.

Example:

If value is tx_myextension[input][  |  ]  then the fieldname "email" would be wrapped to this value: tx_myextension[input][email]

noWrapAttr

boolean

If this value is true then all wrap attributes of textarea elements are suppressed. This is needed for XHTML-compliancy.

The wrap attributes can also be disabled on a per-field basis by using the special keyword "disabled" as the value of the wrap attribute.

arrayReturnMode

boolean

If set, the <form> tags and the form content will be returned in an array as separate elements including other pratical values. This mode is for use in extensions where the array return value can be more useful.

accessibility

boolean

If set, then the form will be compliant with accessibility guidelines (XHTML compliant). This includes:

  1. label string will be wrapped in <label for="formname[fieldname-hash]"> ... </label>

  2. All form elements will have an id-attribute carrying the formname with the md5-hashed fieldname appended

Notice: In TYPO3 4.0 and later, CSS Styled Content is configured to produce accessible forms by default.

formName

string

An alternative name for this form. Default will be a unique (random) hash.

<form name=”...”>

fieldPrefix

string

Alternative prefix for the name of the fields in this form. Otherwise, all fields are prefixed with the form name (either a unique hash or the name set in the “formName” property). If set to “0”, there will be no prefix at all.

dontMd5FieldNames

boolean

The IDs generated for all elements in a form are md5 hashes from the fieldname. Setting this to true will disable this behaviour and use a cleaned fieldname, prefixed with the form name as the ID, instead.

This can be useful to style specifically named fields with CSS.

[tsref:(cObject).FORM]

Example: Login

In order to create a login form, you would need to supply these fields:

  1. "username" = username

  2. "userident" = password

  3. "login_status" = "logout" for logout, "login" for login.

If you insert "<!--###USERNAME###-->" somewhere in your document this will be substituted by the username if a user is logged in!

If you want the login-form to change into a logout form you should use conditions to do this. See this TS-example (extract from the static_template "styles.content (default)"):

  # loginform
styles.content.loginform {
  data = Username:|*username=input || Password:|*userident=password 
}
[usergroup = *]
styles.content.loginform.data = Username: <!--###USERNAME###-->  || |submit=submit| Logout
[global]
Example: Mailform

This creates a simple mail form (this is not TypoScript, but the setup code that you should put directly into the "bodytext"-field of a pagecontent record of the type "FORMMAIL":

Name: | *replyto_name= input | Enter your name here
Email: | *replyto_email=input | 
Like TV: | tv=check | 
| formtype_mail = submit | Send this!
| html_enabled=hidden | 1
| subject=hidden| This is the subject
| recipient_copy=hidden | copy@email.com
| auto_respond_msg=hidden|  Hello / This is an autoresponse. //We have received your mail.
| from_name=hidden | Website XY 
| from_email=hidden | noreply@website.com
| organisation=hidden | Organisation XY
| redirect=hidden | 16
| priority=hidden | 5
| tv=hidden | 0

  1. "replyto_name": If the field is named like this the value is used as reply to name in the email software and will not be shown in the mail content. Choose another field name like the_name to use the value as a normal field. Note the asterisk (*) which means the field is required. and the fieldname will be "the_name". Also a default value is set ("Enter your name here")

  2. "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.

  3. "Like TV" is a checkbox. Default is "unchecked".

  4. "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!

  5. "html_enabled" will let the mail be rendered in nice HTML

  6. "use_base64" will send the mail encoded as base64 instead of quoted-printable

  7. "subject": Enter the subject of your mail

  8. "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.

  9. "auto_respond_msg": This is a autoresponder message. This is sent if the email of the "submitter" is known (field: "email"). The value of this is the message broken up in to lines by a slash "/". Each slash is a new line in the email. The first line is used for the subject.

  10. "from_name": With this option you can set the mail header from name, which will be shown in the mail software.

  11. "from_email": With this option you can set the mail header from email, which will be shown in the mail software as sender address.

  12. "organisation": With this option you can set the mail header organisation parameter, which won't be shown in the mail but in the mail header.

  13. "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.

  14. "priority": With this option you can set the priority of the mail from 1 (not important) to 5 (very important). Default is 3.

  15. "tv" (again, but hidden). Repeating this field may be smart as the value "tv" is normally NOT submitted with the value "false" if not checked. Inserting this line will ensure a default value for "tv".

SEARCHRESULT

Search words are loaded into the register in a form ready for linking to pages:

Example:

register:SWORD_PARAMS = '&sword_list[]=word1&sword_list[]=word2 .....'

See typolink for more info!

SEARCHRESULT returns results only from pages with of doktype "Standard" (1), "Advanced" (2) and "Not in menu" (5)

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 searchresult. This is the code substituting the "###NEXT###"-mark

prev

cObject

This cObject will be wrapped by a link to the prev searchresult. This is the code substituting the "###PREV###"-mark

target

target

target til next/prev links!

range

int

The number of results at a time!

20

renderObj

cObject

the cObject to render the searchresults

$cObj->data array is set to the resulting record from the search.

Please note, that in all fields are named [tablename]_[fieldnam]. Thus the pagetitle is in the field "pages_title".

Apart from this, these fields from the pages-table are also present:

uid

renderWrap

wrap

resultObj

cObject

the cObject prepended in the search results returns rows

noResultObj

cObject

the cObject used if the search results in no rows.

noOrderBy

boolean

If this is set, the result is NOT sorted after lastUpdated, tstamp for the pages-table.

wrap

wrap

Wrap the whole content...

stdWrap

->stdWrap

Wrap the whole content...

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 one occurance of a tt_content element on a 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 ":". Eg:pages.title:pages.keywords:tt_content.bodytext

var "stype" = the starting point of the search:false = current page, L-2 = page before currentPage, L-1 = current page, L0 = rootlevel, L1 = from first level, L2 = from second level

var $GLOBALS["HTTP_POST_VARS"]["locationData"]: If this is set, the search is done as was it from another page in the website given by the value of "locationData" here. See the description at the cObject "FORMS".

Only if the page locationData is pointing to, is inside the real rootLine of the site, the search will take this into account.

internal:

var "scount": If this is set this is used as the searchCount - the total rows in the search. This way we don't need to reconstruct this number!

var "spointer": This points to the start-record in the search.

LATER:

var "alldomains" :boolean: If set the search will proceed into other domains

var "allsites" : boolean: If set the search will proceed into other sites (defined by the "root" setting of an active template.)

var "depth":The depth

Search syntax

When you search, you can use three operatortypes

  1. AND: "+", "and" (UK), "og" (DK)  

  2. OR: "or" (UK), "eller" (DK)  

  3. NOT: "-", "not" (UK), "uden" (DK)

Default operator is AND. If you encapsulate words in "" they are searched for as a whole string. The search is case insensitive and matches parts of words also.

Examples:
  1. menu backend - will find pages with both 'menu' and 'backend'.  

  2. "menu backend" - will find pages with the phrase "menu backend".  

  3. menu or backend - will find pages with either 'menu' or 'backend'  

  4. menu or backend not content - will find pages with either 'menu' or 'backend' but not 'content'

Queries to the examples

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.

  1. ... AND ((tt_content.header LIKE '%menu%' OR tt_content.bodytext LIKE '%menu%' OR tt_content.imagecaption LIKE '%menu%') AND (tt_content.header LIKE '%backend%' OR tt_content.bodytext LIKE '%backend%' OR tt_content.imagecaption LIKE '%backend%')) GROUP BY pages.uid

  2. ... AND ((tt_content.header LIKE '%menu backend%' OR tt_content.bodytext LIKE '%menu backend%' OR tt_content.imagecaption LIKE '%menu backend%')) GROUP BY pages.uid

  3. ... AND ((tt_content.header LIKE '%menu%' OR tt_content.bodytext LIKE '%menu%' OR tt_content.imagecaption LIKE '%menu%') OR (tt_content.header LIKE '%backend%' OR tt_content.bodytext LIKE '%backend%' OR tt_content.imagecaption LIKE '%backend%')) GROUP BY pages.uid

  4. ... AND ((tt_content.header LIKE '%menu%' OR tt_content.bodytext LIKE '%menu%' OR tt_content.imagecaption LIKE '%menu%') OR (tt_content.header LIKE '%backend%' OR tt_content.bodytext LIKE '%backend%' OR tt_content.imagecaption LIKE '%backend%') AND NOT (tt_content.header LIKE '%content%' OR tt_content.bodytext LIKE '%content%' OR tt_content.imagecaption LIKE '%content%')) GROUP BY pages.uid

Notice that upper and lowercase does not matter. Also 'menu' as searchword will find 'menu', 'menus', 'menuitems' etc.

USER and USER_INT

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 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 example_callfunction.php file for an example of how this may be usefull for you. Basically it offers you an API of functions which are more or less relevant for you. Refer to the “Include PHP scripts” section in this document.

It's a little like the PHP_SCRIPT concept but this is somehow cleaner, because it's a call to a function previously defined and not an inclusion of a PHP-script file. So this is recommended.

If you create this object as USER_INT, it'll be rendered non-cached, outside the main page-rendering. See the PHP_SCRIPT_INT for details as this is the same concept used there.

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 in typo3/sysext/cms/tslib/media/scripts/example_callfunction.php!

page = PAGE

page.typeNum=0

includeLibs.something = media/scripts/example_callfunction.php

page.30 = USER

page.30 {

  userFunc = user_various->listContentRecordsOnPage

  reverseOrder = 1

}

NOTE: When using a function, the name of the function has to start with “user_”. When using a class, the name of the class must start with “user_” (there are no conditions on the name of the method).

includeLibs

list of resource

(This property applies only if the object is created as USER_INT)

This is a comma-separated list of resources that are included as PHP-scripts (with include_once() function) if this script is included.

This is possible to do because any include-files will be known before the scripts are included. That's not the case with the regular PHP_SCRIPT cObject.

[tsref:(cObject).USER/(cObject).USER_INT]

PHP_SCRIPT

This includes a PHP-script. You should not name these script ".php" but rather ".inc" as it's meant to be included and not executed on it's own.

NOTE: This options is ignored if $TYPO3_CONF_VARS["FE"]["noPHPscriptInclude"]=1; is set in localconf.php.

Property:

Data type:

Description:

Default:

file

resource

File that will be included. This file must be valid PHP-code! It's included with "include()";

Directions:

1) All content must be put into $content. No output must be echo'ed out!

2) Call $GLOBALS["TSFE"]->set_no_cache(), if you want to disable caching of the page. Set this during development! And set it, if the content you create may not be cached.

NOTE: If you have a parsing error in your include script the $GLOBALS["TSFE"]->set_no_cache() function is NOT executed and thereby does not disable caching. Upon a parse-error you must manually clear the page-cache after you have corrected your error!

3) the array $conf contains the configuration for the PHP_SCRIPT cObject. Try debug($conf) to see the content printed out for debugging!

See later in this manual for an introduction to writing your own PHP include-scripts.

[tsref:(cObject).PHP_SCRIPT]

PHP_SCRIPT_INT

(see PHP_SCRIPT)

Property:

Data type:

Description:

Default:

file

resource

File that will be included. This file must be valid PHP-code! It's included with "include()";

Purpose:

This basically works like PHP_SCRIPT. But the vital difference is that inserting a PHP_SCRIPT_INT (internal opposed to external, see below) merely inserts a divider-string in the code and then serializes the current cObj and puts it in the $GLOBALS["TSFE"]->config[“INTincScript”]-array. This array is saved with the cached page-content.

Now, the point is, that including a script like this lets you avoid disabling pagecaching. The reason is that the cached page contains the divider string and when a “static” page is fetched from cache, it's divided by that string and the dynamic content object is inserted.

This is the compromise option of all three PHP_SCRIPT-cObjects, because the page-data is all cached, but still the pagegen.php script is included, which initializes all the classes, objects and so. What you gain here is an environment for your script almost exactly the same as PHP_SCRIPT because your script is called from inside a class tslib_cObj object. You can work with all functions of the tslib_cObj-class. But still all the “static” pagecontent is only generated once, cached and only your script is dynamically rendered.

Rules:

- calls to $GLOBALS["TSFE"]->set_no_cache() and $GLOBALS["TSFE"]->set_cache_timeout_default() makes no sense in this situation.

- parsing errors does not interfere with caching

- Be aware that certain global variables may not be set as usual and be available as usual when working in this mode. Most scripts should work out-of-the-box with this option though.

- Dependence and use of LOAD_REGISTER is fragile because the PHP_SCRIPT_INT is not rendered until after the cached content and due to this changed order of events, use of LOAD_REGISTER may not work.

- You can not nest PHP_SCRIPT_INT and PHP_SCRIPT_EXT in PHP_SCRIPT_INT. You may nest PHP_SCRIPT cObjects though.

includeLibs

list of resource

This is a comma-separated list of resources that are included as PHP-scripts (with include_once() function) if this script is included.

This is possible to do because any include-files will be known before the scripts are included. That's not the case with the regular PHP_SCRIPT cObject.

[tsref:(cObject).PHP_SCRIPT_INT]

PHP_SCRIPT_EXT

(see PHP_SCRIPT)

Property:

Data type:

Description:

Default:

file

resource

File that will be included. This file must be valid PHP-code! It's included with "include()";

Purpose:

This works like PHP_SCRIPT_INT, because a divider string is also inserted in the content for this kind of include-script. But the difference is that the content is divided as the very last thing before it's output to the browser.

This basically means that PHP_SCRIPT_EXT (external, because it's included in the global space in index_ts.php file!!) can output data directly with echo-statements!

This is a very “raw” version of PHP_SCRIPT because it's not included from inside an object and you have only very few standard functions from TYPO3 to call.

This is the fastest option of all three PHP_SCRIPT-cObjects, because the page-data is all cached and your dynamic content is generated by a raw php-script

Rules:

- All content can be either 1) echo'ed out directly, or 2) returned in $content.

- calls to $GLOBALS["TSFE"]->set_no_cache() and $GLOBALS["TSFE"]->set_cache_timeout_default() makes no sense in this situation.

- parsing errors does not interfere with caching

- In the global name-space, the array $REC contains the current record when the file was “inserted” on the page, and $CONF-array contains the configuration for the script.

- Don't mess with the global vars named $EXTiS_*  

includeLibs

list of resource

This is a comma-separated list of resources that are included as PHP-scripts (with include_once() function) if this script is included.

This is possible to do because any include-files will be known before the scripts are included. That's not the case with the regular PHP_SCRIPT cObject.

[tsref:(cObject).PHP_SCRIPT_EXT]

TEMPLATE

Property:

Data type:

Description:

Default:

template

cObject

This must be loaded with the template-code. If not the object returns nothing.

subparts

Array... of

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:

subparts {

  HELLO = TEXT

  HELLO.value = En subpart er blevet erstattet!!

}

In the templates:

<!--  start of subpart: ###HELLO### -->

This is the HTML.code, that will be loaded in the register and replaced with the result...

<!-- end ###HELLO### -->

NOTE:

Before the content-objects of each subpart is generated, all subparts in the array are extracted and loaded into the register so that you can load them from there later on.

The register-key for each subparts code is "SUBPART_[theSubpartkey]".

In addition the current-value is loaded with the content of each subpart just before the cObject for the subpart is parsed. That makes it quite easy to load the subpart of the cObject (eg: ".current=1")

Eg. this subpart above has the register-key "SUBPART_HELLO".

This is valid ONLY if the property .nonCachedSubst is not set! (see below)

relPathPrefix

string / properties

Finds all relative references (eg. to images or stylesheets) and prefixes this value.

If you specify properties (uppercase) these will match HTML tags and specify alternative paths for them. See example below.

If the property is named "style" it will set alternative path for the "url()" wrapper that may be in <style> sections.

Example:

page.10 = TEMPLATEpage.10 {  template = FILE  template.file = fileadmin/template.html  relPathPrefix = fileadmin/
  relPathPrefix.IMG = fileadmin/img/}

Inthis example all relative paths found are prefixed "fileadmin/" unless it was the src attribute of an img tag in which case the path prefixed is "fileadmin/img/"

marks

Array... of

cObject

This is an array of marks-markers (case-sensitive).

A mark is defined by one markers in the template. The marker must be wrapped by "###" on both sides. Opposite to subparts, you may NOT insert the subpart-markers inside HTML-comment-tags! (They will not be removed).

Marks are substituted bya str_replace-function. The subparts loaded in the register is available also to the cObjects of markers (only if .nonCachedSubst is not set!).

wraps

Array... of

cObject

This is an array of wraps-markers (case-sensitive).

This is shown best by an example:

Example:

wraps {

  MYLINK = TEXT

  MYLINK.value = <A href=”#”> | </A>

}

In the template:

This is <!--###MYLINK###-->a link to my<!--###MYLINK###--> page!

In this example the MYLINK subpart will be substituted by the wrap which is the content returned by the MYLINK cObject.

workOnSubpart

string

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 templateobject.

markerWrap

wrap

This is the wrap the markers is 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

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

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 depends on incremental substition (where the order of substition 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.

[tsref:(cObject).TEMPLATE]

Example:

page.10 = TEMPLATE
page.10 {
  template = FILE
  template.file = fileadmin/test.tmpl
  subparts {
    HELLO = TEXT
    HELLO.value = This is the replaced subpart-code
  }
  marks {
    Testmark = TEXT
    Testmark.value = This is replacing a simple marker in the HTML-code
  }
  workOnSubpart = DOCUMENT
}

In this example a template named test.tmpl is loaded.

MULTIMEDIA

Property:

Data type:

Description:

Default:

file

resource /stdWrap

The multimedia file. Types are:

txt, html, htm:Inserted directly

class:Java-applet

swf:Flash animation

swa, dcr:ShockWave Animation

wav,au:Sound

avi,mov,asf,mpg,wmv:Movies (AVI, QuickTime, MPEG4)

params

string /stdWrap

This is parameters for the multimedia-objects. Use this to enter stuff like with and height:

Example:

width=200

height=300

... will generate a tag like '<embed .... width="200" height="300">'

height=

An empty string will remove the parameter from the embed-tag

stdWrap

->stdWrap

[tsref:(cObject).MULTIMEDIA]

au, wav:

width of control(default 200)

height of control(default 16)

loop = true / false

autostart = true/false

avi,mov,asf,mpg,wmv:

width of control(default 200)

height of control(default 200)

autostart = true/false    (not "mov", see below for example)

swf,swa,dcr:

width (browserdefault approx. 200)

height (browserdefault approx. 200)

quality(default "high")

class:

width(default 200)

height(default 200)

QuickTime (mov) example:

WIDTH=256 
HEIGHT=208
autoplay=TRUE
CONTROLLER=true 
LOOP=false 
PLUGINSPAGE= http://www.apple.com/quicktime/

EDITPANEL

This content object is inserted only if a backend user is logged in and if that user has enabled “Display Edit Icons” in the front end Admin Panel. If the edit panel is inserted, page caching is disabled as the edit panel offers editing feature only available for backend users.

The edit panel inserts icons for moving, editing, deleting, hiding and creating records.

Property:

Data type:

Description:

Default:

label

string

Title for the panel. You can insert the record title with %s

Example:

Section: <B>%s</B>

allow

string

Define which functions are accessible. Further this list may be reduced, if the BE_USER does not have permission to perform the action

Values should be listed separated by comma. This is the options you can choose between:

toolbar,edit,new,delete,move,hide

(toolbar is a general list of icons regarding the page, so use this for pagerecords only)

newRecordFromTable

string

Will display a panel for creation of new element (in the top of list) on the page from that table.

newRecordInPid

int

Define a page ID where new records (except new pages) will be created.

line

boolean / int

If set, a black line will appear after the panel. This value will indicate the distance from the black line to the panel

edit.displayRecord

boolean

If set, then the record edited is displayed above the editing form.

onlyCurrentPid

boolean

If set, only records with a pid matching the current id (TSFE->id) will be shown with the panel.

innerWrap

wrap

Wraps the edit panel

outerWrap

wrap

Wraps the whole edit panel including the black line (if configured)

previewBorder

boolean / int

If set, the hidden/starttime/endtime/fe_user elements which are previewed will have a border around.

The integer value denotes the thickness of the border

previewBorder.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.

[tsref:(cObject).EDITPANEL]