TYPO3Buddy
TYPO3Buddy is on FacebookTYPO3Buddy is on Twitter
menu

Typoscript constants

When you use the same data in different typoscript templates, it's nice to know there's a way that you don't have to update this data in the different templates. Just update it once in a central place. Let's say you want to hide content based on your IP address. First step is to put this data in the constants section of your main typoscript template.

iphome = 192.168.1.100

Whenever you want to use this data in a typoscript template, you'll use {$iphome} in the setup part of the typoscript template. The following script won't show certain content when the IP address is 127.0.0.1 or 192.168.1.100.

[IP = 127.0.0.1,{$iphome}]
# do nothing
[else]
lib.header = HTML
lib.header.value (
    <script type="text/javascript">somescript;</script>
    <p>Show content</p>
    <p>And some more content</p>
)
[end]

More information on Typoscript constants here.

The TYPO3Buddy website is a tutorial to rebuild the TYPO3Buddy website from scratch. You can choose from a TYPO3 Fluid tutorial and a TYPO3 Templavoila tutorial. You'll build TYPO3 websites like you've done so for years!