Hi,
check at
https://github.com/davidmoreno/onion/blob/master/examples/ofileserver/fileserver.html#L29
It does something like:
{% for file in files %}
<tr>
<td><a href="{{
file.name}}{% if file.type == "dir" %}/{% endif
%}">{{
file.name}}</a></td>
<td>{{file.size}}</td>
<td>{{file.owner}}</td>
</tr>
{% endfor %}
Where files is a dict with key the number, and value the attributes. I
sjson would be something like:
{ "0" : { "size" : "123", "owner" : "dmoreno", "name": "test", "type":
"png"}, "1" : {...} }
Otermplate (and onion) doesnt know (yet?) about arrays in its data
representation layer to otemplate (onion_dict), only dicts and strings.
So the for just iterates through all elements and user can use the
values. In some future version I would like to add support for full
json, maybe using some external library, maybe adding the support to
onion_dict or similar... Anyway, just know its only this: strings and
dicts.
Regards,
David.
--
David Moreno Montero
dmo...@coralbits.com <mailto:
dmo...@coralbits.com>
+34 658 18 77 17
<
http://www.coralbits.com/>
http://www.coralbits.com