Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typoscript condition for empty variable

Is there a way to use Typoscript condition to assign a different value to a TypoScript TEXT if a GET variable is empty ?

Something like that :

xxxx.1 = TEXT
[globalVar = GP:print != ""]
xxxx.1.value = Absent
[else]
xxxx.1.value = Present
[end]

Of course here the != "" doesn't work, so what should I use instead ?

like image 987
ejoubaud Avatar asked Dec 15 '22 21:12

ejoubaud


2 Answers

Here is an example with "if":

1 = TEXT
1 {
    value = Absent
    override = Present
    override.if {
        isTrue.data = GP:print
    }
}
like image 156
Shufla Avatar answered Jan 12 '23 03:01

Shufla


With globalString it's also possible to use a Regular Expression as comparison. Depending on the context this might also be a viable solution.

[globalString = GP:test = /.+/]
# This is only evaluated if GP:test contains one or more characters
[global]
like image 29
mallo Avatar answered Jan 12 '23 03:01

mallo