TSref/tags
TypoScript This page is document in progress.
tags
Used to create custom tags and define how they should be parsed. This is used in conjunction with parseFunc.
| Property: | Data type: | Description: | Default: |
| Array... | cObject +stripNL
+ breakoutTypoTagContent |
Every entry in the Array... corresponds to a tag, that will be parsed. The elements MUST be in lowercase.
Every entry must be set to a content-object. "current" is set to the content of the tag, eg <TAG>content</TAG>: here "current" is set to "content". Parameters: Parameters of the tag is set in $cObj->parameters (key is lowercased): <TAG COLOR="red">content</TAG> => $cObj->parameters[color] = red Special added properties to the content-object: $cObj->parameters[allParams]: this is automatically set to the whole parameter-string of the tag, eg ' color="red"' [cObject].stripNL: is a boolean option, which tells parseFunc that NewLines before and after content of the tag should be stripped. [cObject].breakoutTypoTagContent: is a boolean option, which tells parseFunc that this block of content is breaking up the nonTypoTag content and that the content after this must be re-wrapped. # Examples:
tags.bold = TEXT
tags.bold {
current = 1
wrap = <B> | </B>
}
tags.bold.stripNL = 1
|
[tsref:->tags]
Example
/* This example creates 3 custom tags with css_styled_content. The <LINK>-, <GRAFIX>- and <PIC>-tags <LINK> is made into a typolink and provides an easy way of creating links in text <GRAFIX> will create a gif-file 90x10 pixels where the text is the content of the tag. <PIC> lets us place an image in the text. The content of the tag should be the image-reference in fileadmin/" */ tt_content.text.20.parseFunc { tags { # 1. tag <link></link> or <LINK></LINK> link = TEXT link { # use current content current = 1 typolink{ # ATagBeforeWrap=1 <a><..> </..></a> instead of ATagBeforeWrap=0 <..><a> </a></..> ATagBeforeWrap = 1 # title="Title: current page title" title.data = page : title title.noTrimWrap = | Title: | | # -> href="index.php?id=16" target="_self" class="cssClass" parameter.wrap = 16 _self cssClass # some color wrap = <B><SPAN style="color:red">|</SPAN></B> } } # 2. tag <grafix></grafix> grafix = IMAGE grafix { file = GIFBUILDER file { XY = 90,10 100 = TEXT 100.text.current = 1 100.offset = 5,10 100.nicetext = 1 } altText.current = 1 titleText.current = 1 # in addition some Text: title='Title: bla-bla-Image' titleText.noTrimWrap = | Title: |-Image| } # 3. tag <pic>file.png</pic> -> <img src="fileadmin/img/file.png" > pic = IMAGE pic.file.import = fileadmin/img/ pic.file.import.current = 1 } }