[TYPO3-project-4-3] Variation for TypoScript "if"
JoH asenau
info at cybercraft.de
Thu Jun 11 16:59:07 CEST 2009
> The only use case for comparing a single value against two other
> values is an in-between check: A < B < C vs A < B && B < C
Well - if this is the only use case you can imagine, this doesn't mean there
could be many use cases in the world outside of your personal experience.
For many cases of numerical values you might be correct, but even for them a
multiple check against different values might be possible.
I will give you some examples:
A value in GPvar must match the value of a particular field and has to be in
a certain list, because the FE user belongs to a group, that is not allowed
to see all possible matches of GPvar and field value.
if {
value.data = GPvar:something
equals.field = something
isInList.data = TSFE:fe_user|allowedValuesForThisUser
}
Reading:
if GPvar:something equals the field something and isInList taken from
allowedValuesForThisUser
A layout other than default (0) must be used by the current page and there
must be a value in GPvar L which is matching a certain list of languages:
if {
isPositive.data = TSFE:page|layout
value.data = GPvar:L
isInList.field = language_list
}
Reading:
if page:layout is not 0 or less and GPvar:L isInList taken from the field
language_list
there are thousands of other combinations one could imagine, where a
combination of values and operators would make perfect sense.
Especially when it comes to constants, that can be used to enable something
you will definitely need the combination:
if {
isTrue = {$enableSomething}
value.data = GPvar:L
isInList.field = language_list
}
This will only match, if the GPvar is in the list language_list and somebody
set the constant "enableSomething" for this page.
The problem of the COA syntax in all cases would be, that it would
completely break the "natural language" and add even more text the brain had
to "fade out" to get the clue behind the combination of values and
operators.
This is why I still vote for the solution I described in my first post.
Just another 2 cents - if we can reach 1,- Euro, maybe the solution will be
perfect ;-)
Joey
--
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Twitter: http://twitter.com/bunnyfield
Xing: http://contact.cybercraft.de
T3 cookbook (2nd edition): http://www.4any1.de
TYPO3 Schulung: http://workshops.eqony.com
More information about the TYPO3-project-4-3
mailing list