defining "variables" in TypoScript
|
Designing a template you don't want to use always the same repeating strings. Variables allow to reuse strings in your code and thus make it easier to adapt
your template for other projects.
Example: You want to provide a string with your address to use it somewhere in the site.
Define the constants:
- ###############
- ### CONSTANTS ###
- ###############
- myaddress{
- name= Luigi
- url = http://www.snippit.net
- address {
- street= Via www
- number= 9
- }
Now you can reuse it anywhere in your setup code:
- ###############
- ##### SETUP #####
- ###############
- page = PAGE
- page.typeNum=0
- page.10 = TEXT
- page.10.value = My name is {$myaddress.name}
- page.10.wrap=|<br>
- page.20 = TEXT
- page.20.value = I live in {$myaddress.address.street} {$myaddress.address.number}
- page.20.wrap=|<br>
- page.30 = TEXT
- page.30.value = Visit my homepage
- page.30.wrap=<a href="{$myaddress.url}">|</a>
- #etc.etc.

