Reputation: 5241
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 ?
Upvotes: 4
Views: 13141
Reputation: 1279
I found for instance with a cookie, you can set no value and it will see it a empty?
[globalVar = _COOKIE|user_test_score = ]
So maybe also:
[globalVar = GP:view = ]
Not sure if it is intended but works for cookies anyway.
Upvotes: 0
Reputation: 96
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]
Upvotes: 2
Reputation: 872
Here is an example with "if":
1 = TEXT
1 {
value = Absent
override = Present
override.if {
isTrue.data = GP:print
}
}
Upvotes: 10
Reputation: 74
At first there is no != in typoscript. You can only use >, <, = for conditions.
For your needs you can use this:
[globalVar = GP:view = print]
[end]
Just define a Variable "view" which can become the value "print".
Upvotes: 0