Search the FirstSpirit Knowledge Base
I'm looking for a XOR-operator in my template code. But fact is, that there was none.
So I have to write my statement with common and/or expressions.
Is there a chance to get the XOR (^) operator into the template code?
I hope to find some supporters.
You mean for numbers??
My intenstion are logical comparisons in the if-statement.
$CMS_IF(A && !B || B && !A)$
.. do something ...
or in an other writing
$CMS_IF(!(A && B) && (A || B) )$
... do something ...
to shorten it to
$CMS_IF(A ^ B)$
or something realisable with the same logic.
You could use $CMS_IF (A != B)$..do something
Okay, I give you a more detailed example:
$CMS_IF(A.empty && !B.empty || B.empty && !A.empty)$
We have to generate CSS-classes into our code, but only if one out of A and B is true. When both are true we have to do something different and also if none of them is true.
We thought an XOR might make our code a little bit clearer. When you are familiar with the function of XOR it is easier/faster to get what the code does, than reading the statements I shew. At least this is my opinion.
The longer I think about you suggestion it is not that bad. :smileygrin:
thank you for your idea to improve FirstSpirit. It is important for us to learn from the experiences of our customers and partners. For this reason we appreciate feedback and any suggestion.
We have evaluated the issue once again, but have no plans for a realization in the near future. Therefore, we cannot consider your feature request at this time and I think Peter gave you a good option how to handle this.
You can find more details about our feature selection process in our Features Policy.