NAME

HTML::Template::Extension::HEAD_BODY - Plugins for html file

SYNOPSIS

use HTML::Template::Extension;

my $text = qq
   |
    <HTML>
       <HEAD>
           <SCRIPT Language="Javascript">
               function do_nothing {
                   return void;
               }
           </SCRIPT>
       </HEAD>
       <BODY backgroud="#FFFFFF">
           <H1>This is a template example...</H1>
               The sum between 1+1 is: <TMPL_VAR NAME="result">
       </BODY>
    </HTML>
   |;

my $comp       = new HTML::Template::Extension(
                                           scalarref => \$text,
                                           plugins=>["HEAD_BODY"],
                                           );

$comp->param('result' => 1+1);

print $comp->output;

#  OUTPUT:
#
#   <HTML>
#      <HEAD>
#              <SCRIPT Language="Javascript">
#                      function do_nothing {
#                              return void;
#                      }
#              </SCRIPT>
#      </HEAD>
#      <BODY backgroud="#FFFFFF">
#              <H1>This is a template example...</H1>
#                      The sum between 1+1 is: 2
#      </BODY>
#   </HTML>

$comp->autoDeleteHeader(1);
print $comp->output;

#  OUTPUT:
#
#              <H1>This is a template example...</H1>
#                      The sum between 1+1 is: 2

print $comp->header;

# OUTPUT:
#
#   <HTML>
#      <HEAD>
#              <SCRIPT Language="Javascript">
#                      function do_nothing {
#                              return void;
#                      }
#              </SCRIPT>
#      </HEAD>
#      <BODY backgroud="#FFFFFF">

print $comp->js_header;


# OUTPUT:
#
#              <SCRIPT Language="Javascript">
#                      function do_nothing {
#                              return void;
#                      }
#              </SCRIPT>

DESCRIPTION

This plugin add nothing syntax to HTML::Template but add some methods usefull for parsing html template in an environment where web pages are built embedding more little html templates (have you see my HTML::Puzzle CPAN module?).

It add a costructor parameter "autoDeleteHeader" that, is set to 1, automatically remove html header returning only html code inside BODY tag.

If you have see HTML::Template::Extension::CSTART plugin this is equivalent to

<HTML>
	<HEAD>
	</HEAD>
	<BODY>
		<TMPL_CSTART>
		...
		</TMPL_CSTART>
	</BODY>
</HTML>

But more than this a "header" method will be added to return removed header.

It also have a "js_header" method to return javascript code present in the header.

AUTHOR

Bruni Emiliano, <info@ebruni.it>

SEE ALSO

HTML::Template
HTML::Template::Extension::DO_NOTHING
HTML::Template::Extension::SLASH_VAR
HTML::Template::Extension::CSTART
HTML::Template::Extension::DOC
HTML::Template::Extension::HEAD_BODY