Forum OpenACS Development: Re: New template tags - switch statement

Collapse
Posted by Malte Sussdorff on
This addition is great and makes templates considerably more readable for non programmers. Though I disagree with Lars concerning his idea for storing the variable as well in the case statement for the following reasons:
  • You have to mention the variable in every case statement. Despite the fact that this allows a switch for multi variable combinations it does add more code and you have to doublecheck every case statement whether the variable is the same as in the above case statement.
  • As a grafik designer I'd see the switch statement, see what variable it concerns and decide quickly whether I'd want to change the code in between. That wouldn't work otherwise.
One suggestion would be to have the default behaviour as it is defined right now and add a flag "multiple" to the switch statement with no variable following. This would say that the variables are contained within the case tags as suggested by Lars. We'd just have to encourage people (either by code or by documentation), not to use the multiple functionality if the flag is not set correctly, otherwise you really don't know what might be happening :).