Montag, 28. Februar 2011

Typoscript link with parameters

How to create an external link with parameters with Typoscript

Have you ever had the need to add to an external link some dynamic parameters? Well before you grab your PHP editor and start developing have a look into the following Typoscript listing:

[loginUser = *]

page.201 = COA_INT
page.201 {
10 = TEXT
10.value = My fancy link
10.typolink.parameter {
  dataWrap = http://www.mysite.de/index.php?param=value&id={TSFE:fe_user|user|uid}&name={TSFE:fe_user|user|username}_{TSFE:fe_user|user|city}
 }
}
[global]
What this script does is it creates a link using typolink function and you can add some parameters to it. Good thing here is, that can add some dynamic parameters such as user name of current logged in user.

With accessing TSFE which is the central array that Typo3 uses to store almost everything you can add many more interesting parameters.

Please note that content object used here is COA_INT and that means this is generated every time a page is displayed. This way for every user this example creates a proper parameter.

Keine Kommentare:

Kommentar veröffentlichen