Hi,
i have this code to format output to my page:
[[*ColCnt:is=`3`:then=`three columns`:else=`four columns`]]
I need to have more conditions, something like :
[[*ColCnt:is=`3`:then=`three columns`:is=`4`:then=`four columns`:is=`5`:then=`five columns`]]
Can this be done somehow?
The SELECT-modifier is not dokumented but can it be used?
Or do i need to make a custom output modifyer?
[ed. note: johnjohn22 last edited this post 14 years ago.]
____________________________________________________
-
☆ A M B ☆
- 24,524 Posts
I suspect in this case you would do better with a snippet with a switch structure.
____________________________________________________
Yes, a snippet will be *much* faster. Something like this:
[[!Columns? &colCount=`[[*ColCnt]]` ]]
<?php
/* Columns snippet */
switch ($scriptProperties['colCount']) {
case "1": $output = "one";
break;
case "2": $output = 'two';
break;
case "3": $output = "three";
break;
/* etc. */
default:
$output = 'not set';
}
return $output . ' columns';