I've recently discovered HTML::Template and am very happy with what it can do for me. In an effort to learn more I am modifying several previous CGI scripts I made when I didn't know about templating.
One of these scripts is a single CGI that has about 10 'faces', depending on the POST data it displays a totally different interface, such as Admin, File List, Reports etc... The CGI could be split up, but I prefer it in one neat file .. I suppose this is another topic, is cramming heaps into the one file frowned upon? I realise this is a bit of a pandora's box :) It is basically a small file management system in a single file.
I was after some guidance as to the best way to handle this using templates. I so far have thought of making a separate template file for each 'face' and putting a simple conditional IF block in the beginning of a 'generic' HTML template that then imports the specific template required for that face. This method would allow me to still maintain a single CGI file, but keep the multiple 'faces' of the CGI, while still having good code/design separation.
Would this be considered workable? Any thoughts or accepted standards in this area?
TIA .. Ryan
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.