Mark Stosberg <mark@xxxxxxxxxxxxxxx> wrote
> On 2004-01-23, petersm <petersm@xxxxxxxxxx> wrote:
> >
> > Not to keep harping on the subject, but this is also possible with
> > CheesePizaa::TemplateLoader.
>
> Would it possible to abstract this module so it's useful with DBI and
> H::T, without using the rest of the CheesePizza framework? It seems
> useful and I imagine would be more widely used this way.
I would... The main issue would be that it relies on the CheesePizza::DBI
which is mainly a database abstraction tool that we use to allow us to specify
the same naming convention of the tags. For instance if I have a Foo that
points to a Bar and Bar has several attributes (att1, att2) I could get them
using the CheesePizza::DBI like this
my $result = $cpdbi->RelGet(
items => [qw(_Foo_att1 _Foo_Bar_att1 _Foo_Bar_att2)],
cond => ?, #what ever
);
In this case, $result is an HTML::Template TMPL_LOOP structure. The
CheesePizza::TemplateLoader uses the CheesePizza::DBI so that it have a
TMPL_LOOP like this ...
<tmpl_loop Foo>
Foo's att1 : <tmpl_var _Foo_att1>
Foo's Bar's att1 : <tmpl_var _Foo_Bar_att1>
Foo's Bar's att2 : <tmpl_var _Foo_Bar_att2>
</tmpl_loop>
I shouldn't be too hard to make the TemplateLoader work outside of the
CheesePizza as long as you take the CheesePizza::DBI with it. The
CheesePizza::DBI is really just a relational database interface where you
think of every entity and attribute by giving a 'fully qualified path' to that
attribute, so maybe it should be renamed something like DBIx::Path or
DBIx::Relational, etc
Michael Peters
Venzia
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/cgiapp@xxxxxxxxxxxxxxxxx/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: cgiapp-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: cgiapp-help@xxxxxxxxxxxxxxxxx
|