De:TSref/typolink
This page is document in progress. TypoScript (Liste TypoScript)weitere Typoscript Funktionen
Contents |
typolink
Der Inhalt wird mit einem a-Tag umschlossen.
Wenn diese Funktion durch die parseFunc Funktion aufgerufen wird, dann wird das Array $cObj->parameters mit den Link-Parametern (Kleinbuchstaben!) gefüllt.
| Eigenschaft | Datentyp | Kommentar | Standardwert |
| extTarget | target /stdWrap | target für externe Links. (beginnend mit http:// ) | _top
- |
| target | target /stdWrap | target für interne Links, z.B. für Frames. |
- |
| no_cache | boolean / stdWrap | Fügt einen "&no_cache=1"-Parameter zu dem Link hinzu. Das weißt Typo3 an, dass die daraufhin aufgerufene Seite nicht gecached wird. |
- |
| useCacheHash | boolean | Wenn useCacheHash gesetzt ist, dann werden für die in additionalParams übergebenen Parameter ein Hash wert berechnet der in &cHash mit übergeben wird. Die so aufgerufene Seite wird dann in Zusammenhang mit diesem Hash-Wert gecached. Der Key [SYS][encryptionKey] wird in der Hash-Funktion verwendet, wenn dafür ein Wert gesetzt wird, kann der hash nicht mehr erraten werden. |
- |
| additionalParams | string /stdWrap | Dieser Parameter wird dem Ende der URL hinzugefügt. Der Code wird direkt eingefügt, das & vor dem ersten Parameter darf also nicht vergessen werde.
#Beispiel: additionalParams = &print=1 #oder additionalParams = &sword_list[]=word1&sword_list[]=word2' |
- |
| .additionalParams.data | getText | es ist möglich, via getText Werte als Parameter zusätzlich zu übergeben.
Diese Funktion ist nur für interne Links aktiv. |
- |
| addQueryString | boolean | Fügt den QUERY_STRING am Anfang des Links sein. Doppelte Parameter werden nicht überprüft - wenn dadurch mehrere gleiche Parameter übergeben werden, wird der letzte Wert verwendet. Um auszuschließen, dass mehrere gleichnamige Parameter in dem Link stehen, kann
config.uniqueLinkVars =1 gesetzt werden. |
- |
| addQueryString.method | string
GET // POST |
Wenn die Methode auf GET oder POST gesetzt wurde, werden entsprechend die übergebenen Daten verwendet. Diese Funktion kann im Zusammenhang mit der Extension RealUrl helfen. |
- |
| addQueryString.exclude | list | Liste von Parametern die aus dem Link entfernt werden sollen (z.B. cHash oder L) |
- |
| wrap | wrap | Wraps the links. |
- |
| ATagBeforeWrap | boolean | If set, the link is first wrapped with ".wrap" and then the <A>-tag. |
- |
| parameter | string /stdWrap |
This is the data, that ->typolink uses to create the link. The value is trimmed and if it's empty, ->typolink returns the input value untouched. NOTE: If used from parseFunc, this value should be imported by: typolink.parameter.data = parameters : allParams Examples:Internal links:
External links:
The input is parsed like this:
Now the input can be an alias or page-id. If the input is an integer it's a page-id, if it's two comma separated integers, it's a id/type pair, else it's an alias. For page-id's or aliases you can prepend a "#" mark with a number indication tt_content record number on the page to jump to! (if .section-property is present, it overrides this). If you insert only "#234" where "234" is the tt_content record number, it links to the current page-id TargetTarget is normally defined by the "extTarget" and "target" properties of typolink. But you may override this target by adding the new target after the parameter separated by a whitespace. Thus the target becomes the second parameter. If the Target parameter is set to the - character, then it's the same as no target passed to the function. This feature enables you to still pass a class as third parameter and title as fourth parameter without setting the target also. Open in windows with fixed dimensions (JavaScript) It is possible to open the link in a window opened by JavaScript (with window.open). For this, just set the target value to 123x456 where 123 is the window width and 456 is the window height. You can also specify additional parameters to the function by entering them separated from the width and height with a colon :. For instance 230x450:resizable=0,location=1 will disable resizing of the window and enable the location bar. Also see property JSwindow. ClassIf you specify a third parameter separated by whitespace in the parameter value this becomes the class-parameter of the link. This class parameter is inserted in the link-tag before any values from .ATagParams which means this class value will override any class value set in ATagParams (at least for MSIE). If set to -, then it's the same as no class passed to the function. This feature enables you to still pass a title as fourth parameter without setting the class also. TitleThe title attribute is normally specified via .ATagParams or directly via the .title property. But you may override this value by adding the desired title as the fourth parameter (parameters separated by whitespace) to typolink. Examples of multiparameters: Consider this .parameter value passed to this function: 51 _blank blueLink This would result in a link approx like this: <a href=?id=51 target=_blank class=blueLink> |
- |
| title | string /stdWrap | Fügt ein title-Attribut im öffnenden a-Tag mit dem gegebenen Wert hinzu. |
- |
| JSwindow_params | string |
Preset values for opening the window. This example lists almost all possible attributes: status=1,menubar=1,scrollbars=1,resizable=1,location=1,directories=1,toolbar=1 |
- |
| returnLast | string |
If set to "url" then it will return the URL of the link ($this->lastTypoLinkUrl) If set to "target" it will return the target of the link. So, in these two cases you will not get the value wrapped but the url or target value returned! |
- |
| section | string /stdWrap | If this value is present, it's prepended with a "#" and placed after any internal url to another page in TYPO3.
This is used create a link, which jumps from one page directly the section on another page. |
- |
| ATagParams | <A>-params /stdWrap |
Additional parameters Example: class=board |
- |
| userFunc | function-name |
This passes the link-data compiled by the typolink function to a user-defined function for final manipulation. The $content variable passed to the user-function (first parameter) is an array with the keys TYPE, TAG, url, targetParams and aTagParams. TYPE is an indication of link-kind: mailto, url, file, page TAG is the full <A>-tag as generated and ready from the typolink function. The latter three is combined into the 'TAG' value after this formula: <a href="'.$finalTagParts["url"].'"'.$finalTagParts["targetParams"].$finalTagParts["aTagParams"].'> The userfunction must return an <A>-tag. |
- |
[tsref:->typolink]
Beispiele:
#Beispiel: Hallo Welt wird auf die Seite mit der id=1 verlinkt page.40 = TEXT page.40.value = Hallo Welt page.40.typolink.parameter = 1 # Beispiel: Hallo Welt wird auf die Seite mit der id=1 verlinkt, # dabei wird der type auf 98 (in der Regel die Druckansicht) gesetzt page.40 = HTML page.40.value = Hallo Welt # Bei HTML setzt die stdWrap Funktion typolink # auf .value auf, bei TEXT dagegen direkt auf der gleichen Ebene wie .value page.40.value.typolink.parameter = 1,98
Link im Popup-Fenster öffnen
page.40 = TEXT page.40.value = Hallo Welt page.40.typolink.parameter = 1 400x500 # es wir ein Link mit dem Text "Hallo Welt" erzeugt. # Die Seite mit der ID 1 wird in einem 400x500 großen Popup-Fenster geöffnet.
lib.stdheader überschreiben
lib.stdheader >
lib.stdheader = TEXT
lib.stdheader {
field = header
typolink.parameter.field = header_link
}
Aus dem Feld header wird der Titel gelesen und aus dem Feld header_link wird das Ziel für den Link gelesen.