Open betrixed opened 3 years ago
@betrixed
Please, in your documentation, show how to pass results from generic query for a record set with multiple fields, and multiple rows.
E.g.
string[] data = [...];
// data will be accessible in template
view.assign("data", data);
// render view
return view.render("home");
<ol>
{% for item in data %}
<li>{{ item}}</li>
{% endfor %}
</ol>
Right now, I am exploring the hunt - dlang way of doing things. I have used dlang before, so it shouldn't be too much a learning curve. I am still looking through the source tree in the .dub/packages and guessing.
I have a Website in PHP. A common idiom is to do a database query, and pass results to a template as array of record objects, or array of array of key-value pairs.
Please, in your documentation, show how to pass results from generic query for a record set with multiple fields, and multiple rows.
So I can get a query result, but how best to generate a template which can iterate multiple data rows? At the moment, the view documentation suggests view.assign supports a named string value, or a named associative array, string[string]. There seems to be a possibility of the template execution being aware of the interfaces of the EntityRepository, ORM , and be able to iterate using the template macros. I realize that interpreted AST templates will have limits, and this one would be a priority for any further progress for me. It isn't easy, as some other project would have managed it already.