De:TSref/tags
TypoScript (Liste TypoScript) This page is document in progress.
tags
Die Funktion tags wird dazu verwendet, eigene HTML-Tags zu definieren und zu parsen. Das Bekannteste Tag ist <LINK 123>Seite mit der ID 123</LINK>, das dazu verwendet wird auch in Textfeldern wie Bildunterschriften usw. Links zu ermöglichen.
| Eigenschaft | Datentyp | Kommentar | Standardwert
|
| Array... |
cObject + stripNL + breakoutTypoTagContent |
Jeder Eintrag im Array entspricht einem Tag das geparst wird. Das Element muss in Kleinbuchstaben definiert werden.
Jeder Eintrag (jedes Tag) muss über ein Content-Objekt definiert werden. "current" wird mit dem Inhalt des Tags gefüllt, so wird hier der Wert "current" auf "content" gesetzt: <TAG>content</TAG>. Der Wert kann dann über stdWrap.current = 1 verwendet werden. Parameters: Parameter des Tags sind in $cOb->parameters (Attribut-Name in Kleinbuchstaben) gesetzt: <TAG COLOR="red">content</TAG> $cObj->parameters[color] = red
$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. # Beispiel: tags.fett = TEXT tags.fett { current = 1 wrap = <B> | </B> } tags.fett.stripNL = 1 |
[tsref:->tags]
Beispiel
/* Hier werden 3 benutzerdefinierte tags erzeugt unter Verwendung von css_styled_content (groß/klein egal): <LINK>-, <GRAFIX>- und <PIC> <LINK> ist als typolink und erzeugt auf einfache Weise Verweise im Text <GRAFIX> erzeugt eine gif-Datei mit 90x10 Bildpunkten wobei der Text der Inhalt des tags ist <PIC> Bild im Text: der Inhalt sollte eine Bilddatei sein, die tatsächlich unter "fileadmin/img/" existiert */ tt_content.text.20.parseFunc { tags { # 1. tag <link></link> oder <LINK></LINK> link = TEXT link { # aktuellen Inhalt übergeben current = 1 typolink{ # 1:<a><..> </..></a> statt 0:<..><a> </a></..> ATagBeforeWrap = 1 # title="Titelei: Aktueller Seitentitel" title.data = page : title title.noTrimWrap = | Titelei: | | # -> href="index.php?id=16" target="_self" class="cssClass" parameter.wrap = 16 _self cssClass # etwas Farbe 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 titleText.noTrimWrap = | Titel: |-Bild| } # 3. tag <pic>Datei.png</pic> -> <img src="fileadmin/img/Datei.png" > pic = IMAGE pic.file.import = fileadmin/img/ pic.file.import.current = 1 } }