How to use constants with conditions in typoscript


TYPO3 is a free and open source content management system as well as a Model–view–controller (MVC) Web Application Development framework written in PHP. It is released under the GNU General Public License and it can run on Apache or IIS on top of Linux, Microsoft Windows, OS/2 or Mac OS X.
TypoScript is a declarative language like HTML and Javascript used to configure extensions and the template engine.

A problem that I encountered on a project was to put a condition in the template setup with a constant declared in the Constants fields. Oddly, it didn’t work the old fashion way. After spending some time and researching the web, I’ve discovered there’s a way to use constants with conditions. The following code checks if the constant named condition is 1 or 0, followed by some code.
[globalVar = LIT:1 = {$x}]



Where $x is the constant that you want to check for its value. For more imformations about conditions in typoscript you can find in the Typo3 documentation or more specifically here:

Finally, there’s another very important peculiarity of what does Cialis that brings it so high above its alternatives. It is the only med that is available in two versions – one intended for use on as-needed basis and one intended for daily use. As you might know, Viagra and Levitra only come in the latter of these two forms and should be consumed shortly before expected sexual activity to ensure best effect. Daily Cialis, in its turn, contains low doses of Tadalafil, which allows to build its concentration up in your system gradually over time and maintain it on acceptable levels, which, consequently, makes it possible for you to enjoy sex at any moment without having to time it.

3 thoughts on “How to use constants with conditions in typoscript”
  • It was very interesting for me to read that blog. Thank you for it. I like such themes and anything that is connected to this matter. I definitely want to read more soon. BTW, rather good design this blog has, but what do you think about changing it once in a few months?

    Kate Meetington

    June 25, 2010 at 7:57 pm
  • Roman Geber says:

    Thanks for this. Finding this page before digging into other sources sure saved me a lot of time. Works great 🙂

    June 19, 2011 at 5:03 pm
  • Kevin says:

    Thank you!
    Exaclty what i’m searching for!

    February 27, 2012 at 11:52 am

Comments are closed.

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.