Thanks to mst and edenc on irc, I managed to reuse a configuration for connect_info among a number of models. And then I wrote it up for the wiki:
http://dev.catalystframework.org/wiki/gettingstarted/howtos
/ModelConfigSharing.highlight
This is my electronic log book for the documentation of experience, problems and solutions I encounter.
Sunday, October 5, 2008
Thursday, October 2, 2008
Template toolkit rendering a hash
I wanted to render a which I generated within my app; it is a calendar basically:
$calendar{$year}{$month}{$day} = daynumber; which I add stash as:
$c->stash->{calendar} = $calendar;
the code I used to get this working is as follows:
[% FOREACH year IN calendar.keys -%]
[% FOREACH month IN calendar.$year -%]
[% SET m = month.key %]
[% FOREACH day IN calendar.$year.$m -%]
[% SET d = day.key %]
values =
[% year %],
[% month.key %],
[% day.key %],
day number = [% calendar.$year.$m.$d %]
[% END %]
[% END %]
[% END %]
$calendar{$year}{$month}{$day} = daynumber; which I add stash as:
$c->stash->{calendar} = $calendar;
the code I used to get this working is as follows:
[% FOREACH year IN calendar.keys -%]
[% FOREACH month IN calendar.$year -%]
[% SET m = month.key %]
[% FOREACH day IN calendar.$year.$m -%]
[% SET d = day.key %]
values =
[% year %],
[% month.key %],
[% day.key %],
day number = [% calendar.$year.$m.$d %]
[% END %]
[% END %]
[% END %]