[%# # IMPORTANT NOTE # This documentation is generated automatically from source # templates. Any changes you make here may be lost. # # The 'docsrc' documentation source bundle is available for download # from http://www.template-toolkit.org/docs.html and contains all # the source templates, XML files, scripts, etc., from which the # documentation for the Template Toolkit is built. -%] [% META book = 'Library' page = 'HTML' %] [% WRAPPER toc; PROCESS tocitem title ="DESCRIPTION" subs = [ "Headers, Footers and Pages", "Tables, Bars and Boxes" ]; PROCESS tocitem title ="AUTHOR" subs = []; PROCESS tocitem title ="VERSION" subs = []; PROCESS tocitem title ="COPYRIGHT" subs = []; PROCESS tocitem title ="SEE ALSO" subs = []; END %] [% WRAPPER section title="DESCRIPTION" -%]

NOTE: This documentation is incomplete and may be incorrect in places.

The 'html' template library is distributed as part of the Template Toolkit. It can be found in the 'templates' sub-directory of the installation directory.

    use Template;
    my $tt2 = Template->new({
	INCLUDE_PATH => '/usr/local/tt2/templates',
    });

For a portable way to determine the installation 'templates' directory, you can use the 'Template::Config->instdir()' class method.

    use Template;
    my $tt2 = Template->new({
	INCLUDE_PATH => Template::Config->instdir('templates'),
    });

You should now be able to access the html library as, for example:

    [% tt_start_tag %] INCLUDE html/header [% tt_end_tag %]

Note that some of the more basic elements don't give you much more than the raw HTML tags. In many cases you might be well advised to stick to regular HTML rather than complicating matters by the use of template elements.

e.g.

    <table>
      . . .
    </table>

vs

    [% tt_start_tag %] WRAPPER html/table [% tt_end_tag %]
       . . .
    [% tt_start_tag %] END [% tt_end_tag %]

However, the use of template elements to generate the underlying HTML does have some important benefits, particularly as the constructs start to get more complicated and more magical.

See the example in the 'examples' sub-directory of the distribution directory for further examples and enlightenment on using this library.

[% WRAPPER subsection title = "Headers, Footers and Pages" -%] [%- END %] [% WRAPPER subsection title = "Tables, Bars and Boxes" -%] [%- END %] [%- END %] [% WRAPPER section title="AUTHOR" -%]

Andy Wardley <abw@andywardley.com>

[% ttlink('http://www.andywardley.com/', 'http://www.andywardley.com/') -%]

[%- END %] [% WRAPPER section title="VERSION" -%]

2.70, distributed as part of the Template Toolkit version 2.14, released on 04 October 2004.

[%- END %] [% WRAPPER section title="COPYRIGHT" -%]
  Copyright (C) 1996-2004 Andy Wardley.  All Rights Reserved.
  Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

[%- END %] [% WRAPPER section title="SEE ALSO" -%]

[% ttlink('Template::Library::Splash', 'Template::Library::Splash') -%]

[%- END %]