home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / HTML.pod < prev    next >
Encoding:
Text File  |  2004-01-30  |  6.4 KB  |  317 lines

  1. #============================================================= -*-perl-*-
  2. #
  3. # Template::Library::HTML
  4. #
  5. # DESCRIPTION
  6. #   The HTML library provides a number of basic templates for use in
  7. #   building HTML pages.
  8. #
  9. # AUTHOR
  10. #   Andy Wardley  <abw@andywardley.com>
  11. #
  12. # COPYRIGHT
  13. #   Copyright (C) 1996-2001 Andy Wardley.  All Rights Reserved.
  14. #   Copyright (C) 1998-2001 Canon Research Centre Europe Ltd.
  15. #
  16. #   This module is free software; you can redistribute it and/or
  17. #   modify it under the same terms as Perl itself.
  18. #
  19. # REVISION
  20. #   2.69
  21. #
  22. #========================================================================
  23.  
  24.  
  25. #------------------------------------------------------------------------
  26. # IMPORTANT NOTE
  27. #   This documentation is generated automatically from source
  28. #   templates.  Any changes you make here may be lost.
  29. #   The 'docsrc' documentation source bundle is available for download
  30. #   from http://www.template-toolkit.org/docs.html and contains all
  31. #   the source templates, XML files, scripts, etc., from which the
  32. #   documentation for the Template Toolkit is built.
  33. #------------------------------------------------------------------------
  34.  
  35. =head1 NAME
  36.  
  37. Template::Library::HTML - Template library for building basic HTML pages
  38.  
  39. =head1 DESCRIPTION
  40.  
  41. B<NOTE:> This documentation is incomplete and may be incorrect
  42. in places. 
  43.  
  44. The 'html' template library is distributed as part of the Template
  45. Toolkit.  It can be found in the 'templates' sub-directory of the
  46. installation directory.
  47.  
  48.     use Template;
  49.  
  50.     my $tt2 = Template->new({
  51.     INCLUDE_PATH => '/usr/local/tt2/templates',
  52.     });
  53.  
  54. For a portable way to determine the installation 'templates' directory,
  55. you can use the C<Template::Config-E<gt>instdir()> class method.
  56.  
  57.     use Template;
  58.  
  59.     my $tt2 = Template->new({
  60.     INCLUDE_PATH => Template::Config->instdir('templates'),
  61.     });
  62.  
  63. You should now be able to access the html library as, for example:
  64.  
  65.     [% INCLUDE html/header %]
  66.  
  67. Note that some of the more basic elements don't give you much more
  68. than the raw HTML tags.  In many cases you might be well advised to
  69. stick to regular HTML rather than complicating matters by the use
  70. of template elements.
  71.  
  72. e.g.
  73.  
  74.     <table>
  75.       . . .
  76.     </table>
  77.  
  78. vs
  79.  
  80.     [% WRAPPER html/table %]
  81.        . . .
  82.     [% END %]
  83.  
  84. However, the use of template elements to generate the underlying HTML
  85. does have some important benefits, particularly as the constructs start
  86. to get more complicated and more magical.
  87.  
  88. See the example in the 'examples' sub-directory of the distribution
  89. directory for further examples and enlightenment on using this library.
  90.  
  91. =head2 Headers, Footers and Pages
  92.  
  93. =over 4
  94.  
  95. =item header
  96.  
  97. The 'header' element generates the regular header required as the 
  98. pre-amble for an HTML document.  That is, everything from the initial
  99. E<lt>htmlE<gt> to the opening E<lt>bodyE<gt>.
  100.  
  101.     [% INCLUDE html/header
  102.          title = 'This is a Test'
  103.      bgcol = '#ffffff'
  104.     %]
  105.  
  106. Additional header items can be provided by explicitly setting the 'headers'
  107. variable, e.g.
  108.  
  109.     [% headers = BLOCK %]
  110.     <META name="description" content="Template Toolkit">
  111.     <META name="REVISIT-AFTER" content="14 days">    
  112.     <META name="keywords" content="Templates, Web, ...etc...">
  113.     [% END %]
  114.  
  115.     [% INCLUDE html/header
  116.      title = 'This is a Test'
  117.      bgcol = '#ffffff'
  118.     %]
  119.  
  120. =item footer
  121.  
  122. The 'footer' element generates the terminating E<lt>/bodyE<gt> and
  123. E<lt>/htmlE<gt> element to balance the header.
  124.  
  125.     [% PROCESS html/header %]
  126.  
  127.     ...page content here...
  128.  
  129.     [% PROCESS html/footer %]
  130.  
  131. =item page
  132.  
  133. The 'page' element combines the 'html/header' and 'html/footer' elements.
  134.  
  135.     [% WRAPPER html/page %]
  136.  
  137.     ...page content here...
  138.  
  139.     [% END %]
  140.  
  141. Page content should be defined in the 'content' variable (e.g. via WRAPPER).
  142. Additional HTML headers should be defined in the 'headers' variable.
  143.  
  144.     [% WRAPPER html/page
  145.         headers = '<META name="keywords" content="foo, bar, ...">'
  146.     %]
  147.  
  148.     ...page content here...
  149.  
  150.     [% END %]
  151.  
  152. =back
  153.  
  154. =head2 Tables, Bars and Boxes
  155.  
  156. =over 4
  157.  
  158. =item table
  159.  
  160. A basic element for creating HTML tables.
  161.  
  162.     [% WRAPPER html/table pad=10 space=4 col='#404040' %]
  163.        <tr>
  164.     <td>Hello</td> <td>World</td>
  165.        </tr>
  166.     [% END %]
  167.  
  168. The following variables may be defined:
  169.  
  170. =over 4
  171.  
  172. =item border
  173.  
  174. Set the border width (default: 0)
  175.  
  176. =item col
  177.  
  178. Set the background colour (default: none).
  179.  
  180. =item width
  181.  
  182. Set a fixed table width.
  183.  
  184. =item pad
  185.  
  186. Set the cellpadding.
  187.  
  188. =item space
  189.  
  190. Set the cellspacing.
  191.  
  192. =item content
  193.  
  194. Content for the box.  Supplied automatically if used via WRAPPER.
  195.  
  196. =back
  197.  
  198. =item row
  199.  
  200. A basic element for creating HTML table rows.
  201.  
  202.     [% WRAPPER html/table %]
  203.        [% WRAPPER html/row %]
  204.     <td>Hello</td> <td>World</td>
  205.        [% END %]
  206.     [% END %]
  207.  
  208. The following variables may be defined:
  209.  
  210. =over 4
  211.  
  212. =item col
  213.  
  214. Set the background colour (default: none).
  215.  
  216. =item valign
  217.  
  218. Set the vertical alignment.
  219.  
  220. =item rowspan
  221.  
  222. Specify the number of rows to span.
  223.  
  224. =item content
  225.  
  226. Content for the box.  Supplied automatically if used via WRAPPER.
  227.  
  228. =back
  229.  
  230. =item cell
  231.  
  232. A basic element for creating HTML table cells.
  233.  
  234.     [% WRAPPER html/table %]
  235.        [% WRAPPER html/row %]
  236.       [% INCLUDE html/cell 
  237.         FOREACH content = ['Hello', 'World'] %]
  238.        [% END %]
  239.     [% END %]
  240.  
  241. The following variables may be defined:
  242.  
  243. =over 4
  244.  
  245. =item col
  246.  
  247. Set the background colour (default: none).
  248.  
  249. =item align
  250.  
  251. Set the horizontal alignment.
  252.  
  253. =item colspan
  254.  
  255. Specify the number of columns to span.
  256.  
  257. =item content
  258.  
  259. Content for the cell.  Supplied automatically if used via WRAPPER.
  260.  
  261. =back
  262.  
  263. =item bar
  264.  
  265. The bar element is a wrapping of html/table + html/row.
  266.  
  267.     [% WRAPPER html/bar %]
  268.        <td>Foo</td>  <td>Bar</td>
  269.     [% END %]
  270.  
  271. =item box
  272.  
  273. The box element is a wrapping of html/table + html/row + html/cell
  274.  
  275.     [% WRAPPER html/box %]
  276.        Hello World!
  277.     [% END %]
  278.  
  279. =back
  280.  
  281. =head1 AUTHOR
  282.  
  283. Andy Wardley E<lt>abw@andywardley.comE<gt>
  284.  
  285. L<http://www.andywardley.com/|http://www.andywardley.com/>
  286.  
  287.  
  288.  
  289.  
  290. =head1 VERSION
  291.  
  292. 2.69, distributed as part of the
  293. Template Toolkit version 2.13, released on 30 January 2004.
  294.  
  295. =head1 COPYRIGHT
  296.  
  297.   Copyright (C) 1996-2004 Andy Wardley.  All Rights Reserved.
  298.   Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
  299.  
  300. This module is free software; you can redistribute it and/or
  301. modify it under the same terms as Perl itself.
  302.  
  303. =head1 SEE ALSO
  304.  
  305. L<Template::Library::Splash|Template::Library::Splash>
  306.  
  307. =cut
  308.  
  309. # Local Variables:
  310. # mode: perl
  311. # perl-indent-level: 4
  312. # indent-tabs-mode: nil
  313. # End:
  314. #
  315. # vim: expandtab shiftwidth=4:
  316.