Jeff MacDonald wrote:
Hi,

I've been using an internal CGI framework for the past few yers. We do
smething like this to draw a screen that is not taking data from the
user :

foo.cgi?a=s&screen=dataEntryForm

Which means action = s [draw a screen] and the screen is probably
somewhere like templates/dataEntryForm.tpl

And if dataEntryForm has things in it that require getting data from
the database or what have you.. it can get all those things it self.
With special tags like <?
exec_func("main::drawSelectList($dbh,"countries")"); ?> etc... we load
in these templates, parse them up and spit them out.. we also have
some special tags so that any template may have access to query form
variables etc.. as well, templates can execute sql queries and draw
lists on their own.

All of those things are possible using Template Toolkit and there are many people on this list that use TT with C::A (I'm one of them). But I would caution against using anything inside of you templates that would have sideaffects. For instance, letting your templates execute straight SQL is, in my opinion a bad idea since it can lead to bugs that are very hard to track down.


I would suggest that you abstract simple data access out into DAO modules (a la Class::DBI) and then use those methods from your templates. This would reduce the complexity of the templates themselves and also give you a nice clean separation.

Now, when I do the same things using CGI::App and consequently
HTML::Templates, I use a specific runmode for each and every page in
my application.. and i put HTML::Template variables inside the pages..
then of course i have to grab the data i need each time for each
runmode, assign them to template variables and draw teh template.

Don't think that you have to use HTML::Template.

What I'm looking for is a method which i cause use 1 single runmode to
display any page in my system, [and let the pages more or less draw
them selves.] then other runmodes would only be used for doing
business logic, adding things to a database etc.. I thought of using
embedded perl with this.. but I'm not to sure if this is the right
solution..

I think I remeber some talk about this just a bit ago... CGI::Application::Plugin::TemplateRunner? Maybe you could add some of your needs to what that plugin does.


--
Michael Peters
Developer
Plus Three, LP


--------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/cgiapp@lists.erlbaum.net/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to