> Date: Thu, 3 Apr 2003 13:26:22 +0200 > From: [EMAIL PROTECTED] > > On Wed, Apr 02, 2003 at 11:37:28AM -0500, Brett Sanger wrote: > > > > Frankly, I'm not a big fan of a lot of the examples in the > > documentation. They do a lot of things I would thwak anyone here for > > trying (DBI in templates is a No-no! Ditto for CGI.) They do a lot > > more math and contortions than I'd recommend. (Of course, I haven't > > offered alternative docs, so take my criticism in the spirit intended). > > > > How do you solve the DBI-thing ? I am planning to use the toolkit in > the future instead of our own homemade template-system. The very > essential part of this templatesystem is easy DBI-access. Our webapps > contain merely data from sql-databases spread over many different > tables and even different databases. > Why do you consider DBI an no-no anyway ?
When you use TT your system usually contains two types of sources, a) templates and b) perl code. Brett is simply saying the DBI stuff does not belong into the templates, but rather in the perl code. The perl code then makes the results from DBI calls available to templates through the replace hash. Like this, you have full 'perl control' over your data before it is being dispatched to the presentation layer (templates). If you were to make the DBI calls from within the TT DBI plugin and you have to change that data somehow later, then you have to start writing business logic in your templates, and that may not the place where you want it, because your templates are often being maintained by non-programmers. HTH, Hans _______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
