Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conditional block variable isset check. #327

Open
smarchint opened this issue Sep 18, 2017 · 5 comments
Open

conditional block variable isset check. #327

smarchint opened this issue Sep 18, 2017 · 5 comments

Comments

@smarchint
Copy link

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']]));

@Chemaclass
Copy link

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?

@smarchint
Copy link
Author

smarchint commented Sep 19, 2017

@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']]));

@smarchint
Copy link
Author

Luckily, I have found this #325. Waiting for this to get merged. @bobthecow

@Chemaclass
Copy link

@SaikumarChintada Nice one!

@kitepwr
Copy link

kitepwr commented Aug 30, 2019

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants