15 TypoScript Conditions Cheatsheets You Should Need to Know

T3Planet
2 min readNov 22, 2023

--

Modern TYPO3 Cheatsheet: Streamlining Your Workflow with Time-Saving Conditions and Comprehensive Guidelines. This comprehensive guide ensures ease of reference, offering guidelines and examples of TypoScript conditions enriched with the modern Symfony expression language. Effortlessly find the information you need to optimize your TYPO3 development, saving both time and effort.

If you are new to TYPO3, you likely have a question in mind: ‘What is TYPOScript?

1. Combining TYPO3 + Symfony

Have you ever considered the collaboration between TYPO3 and Symfony? It looks pretty cool, doesn’t it?

Essentially, Symfony stands out as a well-known PHP framework, showcasing the wonderful facts and beauty of open-source projects and community collaboration. TYPO3, on the other hand, remains a top-notch CMS that excels not only on its own but also seamlessly integrates with other open-source CMS platforms. Together, they represent the power of open-source synergy in web development.

What’s Symfony Expression Language?

The Symfony Expression Language is a powerful component of the Symfony PHP framework. It provides a flexible way to express conditions or complex logic in a concise and readable manner. The Expression Language allows developers to define dynamic expressions using a simple and consistent syntax. It’s commonly used in Symfony components, such as in configuration files, security access control rules, and other places where complex conditions or configurations need to be expressed in a way that is both human-readable and programmatically interpretable. Symfony Expression Language is a valuable tool for enhancing the flexibility and maintainability of Symfony-based applications.

Let’s Look at Old vs New TypoScript Conditions

The firstly We have a Question in mind How to check TypoScript Conditions?

Find Below 2 ways :

// TYPO3 <= 9.3
[Condition 1] && [Condition 2]
// TYPO3 >= 9.4
[Condition 1 && Condition 2]

Which one is the Current Language?

// TYPO3 <= 9.3
[globalVar = GP:L = 1]
// TYPO3 >= 9.4
[siteLanguage("languageId") == 1]
[siteLanguage("title") == "English"]
[siteLanguage("locale") == "en_US.UTF-8"]

How to check Extension’s Parameters

// TYPO3 <= 9.3
[globalVar = GP:tx_t3terminal_blog|bla > 0]
// TYPO3 >= 9.4
[(request.getQueryParams()['tx_t3terminal_blog'])['bla'] > 0]

What’s a Way to Check TypoScript Constants?

// TYPO3 <= 9.3
[globalVar = LIT:1 = {$myConstant}]
// TYPO3 >= 9.4
[{$myConstant} == 1]

How To Check The Current Page?

// TYPO3 <= 9.3
[globalVar = TSFE:id=17, TSFE:id=24]
[globalVar = TSFE:page|pid=17, TSFE:page|pid=24]

// TYPO3 >= 9.4
[page["uid"] == 17]
[page["uid"] in [17,24]]
[getTSFE().id == 17]
[getTSFE().id in [17,24]]

How To Know Current Page Properties?

// TYPO3 <= 9.3
[page|backend_layout = 1]
// TYPO3 >= 9.4
[page[“backend_layout”] == 1]

Those Are Helpful TypoScript Conditions Cheatsheets , If you want to more Typoscipt CheatSheets find out at — 21 TypoScript Conditions Cheatsheet

--

--

T3Planet

First-Ever TYPO3 Store, a house of 70+ Freemium TYPO3 Products. An Award Winning, Certified TYPO3 Agency with 2K+ Happy Customers and 350K+ Downloads.