Doesn't work.
dbix seems return array of hash like this :
<% comments = [
{
id' => 1,
'id_table' => 'Blog',
'comment' => 'Hello'
},
{
'id' => 2,
'id_table' => 'Blog',
'comment' => 'Hello world'
},
{
'id' => 3,
'id_table' => 'Wiki',
'comment' => 'Test'
}]
%>
I try with :
<% foreach c in comments({id_table => 'Blog'}) %><% c.id %><% end %>
Result :
123
I want only : 1 & 2 here
========================================
Message du : 04/02/2015 19:41
De : "Gert van Oss " <[email protected]>
A : "thorshand" <[email protected]>
Copie à : [email protected]
Sujet : Re: [Templates] Iterate over keys value
Maybe something like this gets you there..?
[% FOREACH country IN all_content.keys.sort %]
[% country %]
[% FOREACH line IN all_content.$country %]
[% line.name %]
[% line.street %]
[% line.city %]
[% END %]
[% END %]
> On 04 Feb 2015, at 12:13, thorshand wrote:
>
> Hi,
>
> Is it possible to iterate over a key value, like :
>
> <% foreach c in comment({id_table = 'Blog'}) %>
> <% c.date %> <% c.id %>
> <% end %>
>
> comment is a resulset of dbix search with columns : id, id_table, name, date,
> ...
> I would like to make one dbi request (don't include where clause in
> resultset) to do this after :
>
> <% foreach table in ('Blog', 'Wiki' ...) %>
> <% foreach c in comment({id_table = table}) %>
> <% c.date %> <% c.id %>
> <% end %>
> <% end %>
>
> Thanks
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates