CGI with stylesheet
|
Social links
Class::Prototype
WWW::Spyder Javascript tricks serial() join function Smart quotes Text to Excel Developing Featherweight Web Services with JavaScript
Miscellaneous
|
|
CGI with stylesheet
|
Description CGIs get muddy quickly. The mix of code and HTML in a long form that is designed to be eye pleasing can make an eyesore for the coder. You can do lots of HERE statements to print your HTML to help or move to a templating system when the HTML going gets tough. Here’s a little trick that helps keep it in the realm of a single CGI when that’s what you need. Notice too that we’re calling CGI::Pretty instead of CGI. It works exactly the same but the HTML output is much easier on the eyes. Update: see use CGI Perl with CSS for many more options for Perl + CSS. Code, click to run it Discussion Stylesheets go a long way to trimming HTML. Usually you’d want to have the stylesheet be outside the CGI or HTML files. But if you are doing a stand alone CGI for someone or for generic distribution it might be best to have the style guides in the CGI. Makes for easier installs. It also ensures some webtwerp won’t edit or delete the stylesheet without letting everyone know.
It’s also quite easy to use CGI or CGI::Pretty to include external
stylesheets too. Just add it in your |
|
Perl Books ·
CPAN ·
mod_perl ·
Perl Monks ·
Perl Mongers ·
Perl Journal ·
Use Perl ·
Perl Jobs ·
ActiveState ·
perldoc.perl.org ·
O’Reilly Perl ·
W3Schools tutorials ·
Ovid's CGI Course ·
Catalyst ·
Perl at Wikipedia
Text, original code, fonts, and graphics ©1990-2009 Ashley Pond V. |