smarty icon indicating copy to clipboard operation
smarty copied to clipboard

Construction: switch - case

Open AlexJMcloud opened this issue 3 years ago • 6 comments

My question is: will the construction be supported: switch case. Example: {switch ($str)} {case 1} 1{/case} {/switch}

AlexJMcloud avatar Sep 20 '22 09:09 AlexJMcloud

We could, but it's not on the roadmap. I'll leave this issue open to see if more people are interested.

wisskid avatar Sep 20 '22 20:09 wisskid

Thanks. I just don't want to add it to your code, because it's included in the project via composer

AlexJMcloud avatar Sep 22 '22 08:09 AlexJMcloud

Feel free to submit a PR if you are up to the task!

wisskid avatar Sep 22 '22 10:09 wisskid

We are interrested!

timmit-nl avatar Nov 24 '22 12:11 timmit-nl

Hi guys! Do you really need switch/case? Just because there is {if}, {elseif} and {/if} already. Smarty3 documentation for if For Smarty4, the documentation is not enough complete to find {elseif}, but probably exists.

webprogramozo avatar Dec 07 '22 11:12 webprogramozo

I think{if}, {elseif} and {/if} is enough for each case in the business logic.

ghost avatar Mar 14 '23 14:03 ghost