CGI-Application-Plugin-MessageStack
    
    
  
  
  
view release on metacpan or search on metacpan
     sub cgiapp_init {
       # setup your session object as usual...
     }
    Meanwhile, in your (HTML::Template) template code:
     ...
     <style type="text/css">
       .INFO {
         font-weight: bold;
       }
       .ERROR {
         color: red;
       }
     </style>
     ...
     <h1>Howdy!</h1>
     <!-- TMPL_LOOP NAME="CAP_Messages" -->
       <div class="<!-- TMPL_VAR NAME="classification" -->">
         <!-- TMPL_VAR NAME="message" -->
     ...
    It's a good idea to turn off 'die_on_bad_params' in HTML::Template - in
    case this plugin tries to put in the parameters and they're not
    available in your template.
    Here's a quick TT example:
     <style type="text/css">
       .INFO {
         font-weight: bold;
       }
       .ERROR {
         color: red;
       }
     </style>
     ...
     <h1>Howdy!</h1>
     [% FOREACH CAP_Messages %]
        <div class="[% classification %]">[% message %]</div>
     [% END %]
lib/CGI/Application/Plugin/MessageStack.pm view on Meta::CPAN
 sub cgiapp_init {
   # setup your session object as usual...
 }
Meanwhile, in your (HTML::Template) template code:
 ...
 <style type="text/css">
   .INFO {
     font-weight: bold;
   }
   .ERROR {
     color: red;
   }
 </style>
 ...
 <h1>Howdy!</h1>
 <!-- TMPL_LOOP NAME="CAP_Messages" -->
   <div class="<!-- TMPL_VAR NAME="classification" -->">
     <!-- TMPL_VAR NAME="message" -->
   </div>
 <!-- /TMPL_LOOP -->
 ...
It's a good idea to turn off 'die_on_bad_params' in HTML::Template - in case this plugin tries to put in the parameters and they're not available in your template.
Here's a quick TT example:
 <style type="text/css">
   .INFO {
     font-weight: bold;
   }
   .ERROR {
     color: red;
   }
 </style>
 ...
 <h1>Howdy!</h1>
 [% FOREACH CAP_Messages %]
    <div class="[% classification %]">[% message %]</div>
 [% END %]
t/output.TMPL view on Meta::CPAN
<html>
<head>
<title>cgiapp messagestack output template</title>
<style type="text/css">
   .INFO {
     font-weight: bold;
   }
   .ERROR {
     color: red;
   }
</style>
</head>
<body>
<p>hello world</p>
t/output.tt view on Meta::CPAN
<html>
<head>
<title>cgiapp messagestack output template</title>
<style type="text/css">
   .INFO {
     font-weight: bold;
   }
   .ERROR {
     color: red;
   }
</style>
</head>
<body>
<p>hello world</p>
t/output_params.TMPL view on Meta::CPAN
<html>
<head>
<title>cgiapp messagestack output template</title>
<style type="text/css">
   .INFO {
     font-weight: bold;
   }
   .ERROR {
     color: red;
   }
</style>
</head>
<body>
<p>hello world</p>
( run in 0.441 second using v1.01-cache-2.11-cpan-5dc5da66d9d )