rev |
line source |
Hans-G?nter@24253
|
1 The Template Toolkit is a collection of Perl modules which implement a fast,
|
Hans-G?nter@24253
|
2 flexible, powerful and extensible template processing system.
|
Hans-G?nter@24253
|
3
|
Hans-G?nter@24253
|
4 It is "input-agnostic" and can be used equally well for processing any kind
|
Hans-G?nter@24253
|
5 of text documents: HTML, XML, CSS, Javascript, Perl code, plain text,
|
Hans-G?nter@24253
|
6 and so on.
|
Hans-G?nter@24253
|
7 However, it is most often used for generating static and dynamic web content,
|
Hans-G?nter@24253
|
8 so that's what we'll focus on here.
|
Hans-G?nter@24253
|
9
|
Hans-G?nter@24253
|
10 Although the Template Toolkit is written in Perl, you don't need to be a Perl
|
Hans-G?nter@24253
|
11 programmer to use it. It was designed to allow non-programmers to easily
|
Hans-G?nter@24253
|
12 create and maintain template-based web sites without having to mess around
|
Hans-G?nter@24253
|
13 writing Perl code or going crazy with cut-n-paste.
|
Hans-G?nter@24253
|
14
|
Hans-G?nter@24253
|
15 However, the Template Toolkit is also designed to be extremely flexible and
|
Hans-G?nter@24253
|
16 extensible. If you are a Perl programmer, or know someone who is, then you
|
Hans-G?nter@24253
|
17 can easily hook the Template Toolkit into your existing code, data, databases
|
Hans-G?nter@24253
|
18 and web applications.
|
Hans-G?nter@24253
|
19 Furthermore, you can easily extend the Template Toolkit through the use of
|
Hans-G?nter@24253
|
20 its plugin mechanism and other developer APIs.
|
Hans-G?nter@24253
|
21
|
Hans-G?nter@24253
|
22 Whatever context you use it in, the primary purpose of the Template Toolkit
|
Hans-G?nter@24253
|
23 is to allow you to create a clear separation between the presentation elements
|
Hans-G?nter@24253
|
24 of your web site and everything else.
|
Hans-G?nter@24253
|
25
|
Hans-G?nter@24253
|
26 If you're generating static web pages, then you can use it to separate the
|
Hans-G?nter@24253
|
27 commonly repeated user interface elements on each page (headers, menus,
|
Hans-G?nter@24253
|
28 footers, etc.) from the core content.
|
Hans-G?nter@24253
|
29 If you're generating dynamic web pages for the front end of a web application,
|
Hans-G?nter@24253
|
30 then you'll also be using it to keep the back-end Perl code entirely separate
|
Hans-G?nter@24253
|
31 from the front-end HTML templates.
|
Hans-G?nter@24253
|
32 Either way, a clear separation of concerns is what allow you to concentrate
|
Hans-G?nter@24253
|
33 on one thing at a time without the other things getting in your way.
|
Hans-G?nter@24253
|
34 And that's what the Template Toolkit is all about.
|