You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.
<ul>
{{#sql SELECT * FROM users}}
<li>{{username}}<br/>
<ul>
{{#sql SELECT * from files where user.id = [id]}}
<li>{{filename}}</li>
{{/sql}}
</ul></li>
{{/sql}}
</ul>
how can I use Context in custom helper to make it work? Also if I'm in helper and call $context->get('id'); will it return the id from sql higher in hierarchy? Do I need to modify Helpers.php to add this helper or is there a way to do it outside of the library in user code?
The text was updated successfully, but these errors were encountered:
First of all, bundling the logic and markup is not a good idea. If that's what you want, embedding html and php in one file would be much better option. Specially because of its performance compared to what you get from this library.
However, if you in really want to do this, have a look at ChildContext. Basically, you need to extend it and provide the data that you want to it. If a variable didn't exist in your own implementation, you fall back to parent context.
#each and #if aren't the same as #sql. Also, running database queries from templates is a very-very bad practice in any template engine community. Even if you can do so you definitely should not.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I wan to create custom helper
sql
:how can I use Context in custom helper to make it work? Also if I'm in helper and call
$context->get('id');
will it return the id from sql higher in hierarchy? Do I need to modify Helpers.php to add this helper or is there a way to do it outside of the library in user code?The text was updated successfully, but these errors were encountered: