[%# # 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 = 'FAQ' page = 'FAQ' %] [% WRAPPER toc; INCLUDE tocitem title='DESCRIPTION' subs=['General Questions', 'Language', 'Plugins', 'Extending the Template Toolkit', 'Miscellaneous']; INCLUDE tocitem title='AUTHOR'; INCLUDE tocitem title='VERSION'; INCLUDE tocitem title='COPYRIGHT'; END %] [% WRAPPER section title='DESCRIPTION' -%]

This is the Frequently Asked Questions list for the Template Toolkit. More accurately, it's a very thin placeholder for where the FAQ will soon be.

[% WRAPPER subsection title = 'General Questions' -%]

- Why is the sky blue?

  Something to do with refraction.

[%- END %] [% WRAPPER subsection title = 'Language' -%]

- Why doesn't [% tt_start_tag %] a = b IF c [% tt_end_tag %] work as expected?

  Because the parser interprets it as [% tt_start_tag %] a = (b IF c) [% tt_end_tag %].

  Do this instead:

          [% tt_start_tag %] SET a = b IF c [% tt_end_tag %]

[%- END %] [% WRAPPER subsection title = 'Plugins' -%]

- Using the Table plugin, how do I order the data to go across rather than down?

  Order the data into rows:

           Steve     Karen     Jeff
           Brooklyn  Nantucket Fairfax
           NY        MA        VA

          [% tt_start_tag %] USE table(data, rows=3) [% tt_end_tag %]

      Then ask for each column

          [% tt_start_tag %] FOREACH column = table.cols [% tt_end_tag %]

      And then print each item in the column going across the output rows

          [% tt_start_tag %] FOREACH item = column [% tt_end_tag %]
      	<td>[% tt_start_tag %] item [% tt_end_tag %]</td>
          [% tt_start_tag %] END [% tt_end_tag %]

[%- END %] [% WRAPPER subsection title = 'Extending the Template Toolkit' -%]

- Can I serve templates from a database?

  Short answer: yes, Chris Nandor has done this for Slash. You need to subclass Template::Provider. See the mailing list archives for further info.

[%- END %] [% WRAPPER subsection title = 'Miscellaneous' -%]

- Can I have another cup of coffee?

  No, I think you've hhhaadd ennnough alllrready.

[%- END %] [%- END %] [% WRAPPER section title='AUTHOR' -%]

Andy Wardley <abw@kfs.org>

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

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

Template Toolkit version 2.01, released on 30th March 2001.

[%- END %] [% WRAPPER section title='COPYRIGHT' -%]

      Copyright (C) 1996-2001 Andy Wardley.  All Rights Reserved.
      Copyright (C) 1998-2001 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 %]