elseif

elseif — Conditional block, the syntax is very similar to the php one, allowing () || && and other php operators. which are if and elseif.

If any of those block contains an elseif statement, the content between {elseif} and {/*blockname*} (you do not need to close the elseif block) will be shown if the block’s condition has no been met

Additional Tplix operators and their equivalent php syntax are as follow:

  • eq → ==
  • neq or ne → !=
  • gte or ge → >=
  • lte or le → <=
  • gt → >
  • lt → <
  • mod → %
  • not → !
  • X is [not] div by Y → (X % Y) == 0
  • X is [not] even [by Y] → (X % 2) == 0 or ((X/Y) % 2) == 0
  • X is [not] odd [by Y] → (X % 2) != 0 or ((X/Y) % 2) != 0
Examples:

Where template is:


{if 3 == 5}
  never gonna happen
{elseif 3 == 3}
  if you don't see this, the world is coming to its end
{else}
  this will never happen, unless, as previously mentionned, the world is coming to its end
{/if}
    

The above example will output:

if you don't see this, the world is coming to its end