Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control logic using HTML::Template

Just a couple of quick questions. If I'm writing CGI programs to create web pages via HTML::Template, then do I have to write separate tmpl files for each distinctive screen (the control logic to be in the Perl code)?

Also, (and in a similar area) is it OK to put url links to the other screen CGI programs within the tmpl files? For example if one screen displays employee details, could I put a link on the department field to display department details on another screen - I'm guessing I can, but want to know if there are repercussions?

Hmm, maybe they are quick questions, but the answers may be involved, so if anyone knows a good web source that explains this a link would suffice.

like image 510
DBMarcos99 Avatar asked Nov 24 '09 16:11

DBMarcos99


1 Answers

The whole point of using HTML::Template is to separate the V (view) from the MC (model and controller) in MVC.

I follow the simple rule of one template file per view. Of course, you can use the <TMPL_INCLUDE> mechanism to avoid unnecessary duplication.

You can include any links you want in the templates. You are just sending HTML to the browser, anyway.

CGI::Application works well with HTML::Template.

like image 75
Sinan Ünür Avatar answered Sep 19 '22 21:09

Sinan Ünür