typo3typoscripttypo3-10.x

Is it possible to compare 2 typoscript functions in a condition


Is it possible to compare the 2 typoscript functions in a condition? If so, what would the syntax be.

site("base").getHost() request.getRequestHostOnly()

Since the following does not seem to work, it seems as it does a string compare but i could be wrong.

[site("base").getHost() == request.getRequestHostOnly()]
page.headerData.850193 = COA
page.headerData.850193 {
  10 = TEXT
  10.wrap (
<script>
!function(f,b,e,v,n,t,s) 
....
)
}
[global]

The case for this is that we only want to load a facebook pixel on valid page visits. TYPO3 also loads the pixel if the site is loaded through a wrapper, like for example translate or other sites.

Any other recommendation would also be welcome.


Solution

  • You could also try to implement a Symfony expression language https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/SymfonyExpressionLanguage/Index.html

    https://symfony.com/doc/current/reference/formats/expression_language.html