perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Wardley" <...@cre.canon.co.uk>
Subject ANNOUNCE: Template Toolkit v1.04
Date Mon, 06 Mar 2000 14:32:16 GMT
The latest version of the Template Toolkit (1.04) is now available
from CPAN:

  authors/id/ABW/Template-Toolkit-1.04.tar.gz

The Template Toolkit is one of the many template processing modules
available from CPAN.  It's a pure 'template' module rather than an
embedded Perl processor and it promotes the separation of Perl code
(content) from HTML templates (presentation).  It doesn't try to
implement an entire programming language, preferring that you write
your code in a real programming language (i.e. Perl) and that you keep
it outside of your template documents.  This is generally a Good
Thing.

The Template Toolkit is generic, fast and extensible and provides a
powerful mechanism for binding Perl values, lists, hashes,
sub-routines or objects into template variables.  This makes it
extremely simple to access any functionality or data that you care to
provide in Perl.  A plugin architecture allows you to load and use
external modules, giving you direct access to CGI, DBI, XML, or any
other modules or code to care to write or install.  The toolkit is
highly conigurable and can easily be extended or subclassed where
necessary.  It is independant of any operating environment
(e.g. mod_perl, CGI, offline batchscripts) and can be used to process
any kind of text document (e.g. HTML, XML, SGML, LaTeX, RTF, plain
text, etc.)

There's extensive documentation which describes the toolkit, a
tutorial, and a README file which gives a general overview and
introduction.  Here's some short template examples to give you a
flavour of what's possible.

ex1:
    [% INCLUDE header
       title = 'Hello World!'
    %]

    The [% animal %] sat on the [% place %]

    [% IF user %]
      <a href="mailto:[% user.email %]">[% user.name %]</a>
    [% END %]

    <ul>
    [% FOREACH item = list %]
       <li>[% item %]
    [% END %]
    </ul>


ex2:  (DBI interface)

    [% USE DBI('DBI:mSQL:mydatabase') %]

    <table>
    [% FOREACH user = DBI.query('SELECT * FROM user') %]
       <tr> <td>[% user.name %]</td> <td>[% user.email %]</td>
</tr>
    [% END %]
    </table>




Enjoy
A






-- 
Andy Wardley <abw@kfs.org>   Signature regenerating.  Please remain seated.
     <abw@cre.canon.co.uk>   For a good time: http://www.kfs.org/~abw/

Mime
View raw message