Question

Hy i have this code.

{if $isModerator && $order->kind==1}
bla bla
{/if}

and $order->kind can be 1,2,3,4,6 so making 5 if is not the idea any idea?

Was it helpful?

Solution

Wouldn't this work for you?

{if $isModerator && in_array($order->kind, array(1,2,3,4,5))}
bla bla
{/if}

Haven't used Smarty for quite a while now, so not sure.

OTHER TIPS

Smarty has a for or while cycle? You could always cycle on that like in pseudocode here:

for($i=0;$i>max($order->kind);$i++){
  if($isModerator and $order->kind==$i){
    //code here
  }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top