Open smarchint opened 7 years ago
Well, if $a
is not define I guess the condition will be false
, so nothing will be render there. Neither an Exception, isn't it?
@Chemaclass As per the issue #284 , the objective is to throw an error for undefined variables. So, my concern was how to throw error if the variable is not provided in the context but is in the template as {{#some_block}}. (if block)
Currently with the solution provided in #284, I am getting and exception with
$m->render("{{#a}}{{b}}{{/a}}", new ThrowyThing(['b' => ['d' => 'E']]));
Luckily, I have found this https://github.com/bobthecow/mustache.php/pull/325. Waiting for this to get merged. @bobthecow
@SaikumarChintada Nice one!
It's been 2 years and it doesn't look like [#325]() got merged.
Is there another feature that accomplishes this (if so what would that be)?
Thx!
in #284, the discussion was ended with a context object as parameter for the mustache_engine's render function. I have a follow up.
How to handle this case ?
$m->render("{{#a}}{{b}}{{/a}}", new ThrowyThing(['b' => ['d' => 'E']]));