user9003762 user9003762 - 8 months ago 117
Smarty Question

How to include multiple values in IF statement (Smarty)

We have an IF statement within our smarty templates, which is as follows:

{if $category->id == 90}


We need to find out how to include multiple categories, so for e.g 95, 96 and 97.

Answer Source

you can just chain them like this:

smarty:

{if $category-> == 90 || $category->id == 95 || $category-> == 96}

{/if}

You can read more about this topic in the official docs: https://www.smarty.net/docsv2/de/language.function.if.tpl

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download