Cdbi and Template Toolkit
From ClassDBI
It is possible to call Class::DBI directly from a Template Toolkit plugin:
[%
USE contact = Class('app::cdbi::contact');
list_contact = contact.retrieve_all();
%]
<table>
[% FOREACH row IN list_contact %]
<tr>
<th>...</th>
<td>...</td>
</tr>
[% END %]
</table>
In most cases you'll probably use search_where() instead of retrieve_all():
[%
USE contact = Class('app::cdbi::contact');
list_contact = contact.search_where(...);
%]
<table>
[% FOREACH row IN list_contact %]
<tr>
<th>...</th>
<td>...</td>
</tr>
[% END %]
</table>
You would probably be happier using an iterator rather than a list as this example shows.
TO-DO - show the code using iterator

