Latte template zero values vs. false in if

Notice: This thread is very old.
heximcz
Member | 1
+
0
-

Hello,

I have a problem in latte template how to properly identify zero and false value in {if}, for example:

<?php
// $foo may by false or a number from zero
$this->template->foo = false;
// or
$this->template->foo = 0;
?>

in Latte template:

{if $value}

is still false.

Anybody help me? Thank you.

Last edited by heximcz (2016-04-06 01:00)

David Matějka
Moderator | 6445
+
+4
-

In latte, you can use (almost) any php expression. in your case:

{if $value !== false}
premek_k
Member | 172
+
+1
-

BTW:

{if $foo !== false}

Latte knows nothing about $value property.