Introduction

Top Close Open

The Template Toolkit is free in both senses of the word: free beer and free speech. It is free in the first sense because it costs absolutely nothing to download and use the Template Toolkit. And it's free in the second sense because it's distributed under an Open Source license. That mean that you get the full source code to the Template Toolkit and you're explicitly granted the right to modify and adapt the code, should you so wish.

Pre-Requisites

Top Close Open

You'll need to have Perl version 5.6.0 or later installed on your machine. Perl comes pre-installed on all modern Unix-based systems (which includes Mac OSX). It's freely available for virtually every modern operating system under the sun, so you have no excuse for not installing it if you don't already have it. Don't be scared now. You don't have to write any Perl code to use the Template Toolkit.

The Template Toolkit also depends on the Perl AppConfig module being installed. But if you use the CPAN module as described below then it will take care of this for you.

Installing from Source Code

Top Close Open

Stable versions of the Template Toolkit source code can be downloaded from CPAN. The latest stable version of the Template Toolkit is 2.26.

Download Template Toolkit stable version 2.26

The source code is distributed as a .tar.gz archive. You'll need to unpack it and follow the instructions in the INSTALL file.

For those impatient types who don't have time to read the documentation, it goes like this:

$ tar zxf Template-Toolkit-2.26.tar.gz
$ cd Template-Toolkit-2.26
$ perl Makefile.PL
$ make
$ make test
$ sudo make install

Developer Versions

Top Close Open

In addition to the stable releases available from CPAN, we also release interim developer versions from time to time. These contain additional features, bug fixes and other updates over the latest stable version.

Developer versions have an additional numerical suffix (e.g. 2.26_01, 2.26_02, etc) and are available to download from this web site. You can also download them from CPAN. Note however that the CPAN module won't install developer releases by default.

There are no developer versions released at present.

Installing with the CPAN Module

Top Close Open

If you have the CPAN module installed then you can install the Template Toolkit like so:

$ sudo cpan Template

The above assumes a Unix-like system (which includes Mac OSX) and uses sudo to run the cpan Template command with administrator privileges.

The CPAN module is distributed with more recent versions of Perl (5.8 and later) so there's a good chance you've already got the CPAN module installed if your version of Perl is up-to-date.

Platform-Specific Binaries

Top Close Open

You can also get the Template Toolkit in "binary form" for installation on various platforms. Don't be misled by the name - you still get the full source code for the Template Toolkit, but it's delivered in a packaged format that you can install straight onto your system without having to build it from source.

Mac OSX

Top Close Open

If you're running Mac OSX (you lucky thing!) then you can install the Template Toolkit using the CPAN module as described above. Run the Terminal application (located in Applications/Utilities) and enter the sudo cpan Template command at the prompt.

Alternately, if you have Fink installed then you can use it to install the Template Toolkit. Christian Schaffner maintains the Fink packages for the Template Toolkit. They can be found in the libs/perlmods. section.

Debian GNU/Linux

Top Close Open

Mako Hill maintains the official Template Toolkit packages for Debian GNU/Linux. They are available in Debian as libtemplate-perl. The Debian package pages for the latest versions can be found at:

http://packages.debian.org/unstable/perl/libtemplate-perl http://packages.debian.org/unstable/perl/libtemplate-perl-doc

You can download the packages and the source for the latest TT2 packages at:

http://people.debian.org/~mako/outgoing/libtemplate-perl/

If you use stable or testing and want to use the latest Template Toolkit packages, then simply add the following line to your sources.list file:

deb http://people.debian.org/~mako/outgoing/ ./

Of course, you can also install the Template Toolkit on any Unix-like system using the CPAN module, as described above.

Microsoft Windows

Top Close Open

If you're using a Microsoft Windows machine then you have our sympathies. However, if you're using Strawberry Perl then you can install TT using the CPAN module as described above. If you're using ActivePerl and then use the Perl Package Manager (PPM) to install the Template Toolkit.

Our friends over at Bugzilla have put a page together telling you where you can find the relevant PPM files.

Links to ActivePerl PPM packages

Github Source Code Repository

Top Close Open

The source code for the Template Toolkit is managed using Git and is hosted at Github If you have git installed on your system then you can check out the Template Toolkit source code using a command like this:

$ git clone git://github.com/abw/Template2.git

You can browse the repository here:

http://github.com/abw/Template2

HTML Documentation

Top Close Open

You can download a copy of the complete HTML documentation for the Template Toolkit. It comes in the same shiny colours as this web site for your viewing pleasure.

HTML documentation for version 2.24

Related Modules

Top Close Open

In times gone by, the Template Toolkit was distributed with a whole bunch of plugin modules for doing all sorts of things. These included: querying databases via the DBI module, processing XML documents, typesetting output using LaTeX, and generating images using the GD library.

In a fit of common sense, they were eventually removed from the core Template Toolkit distribution and made available as separate bundles. You can download them from CPAN using the following links or you can install them using the CPAN module as described above.

Template-DBI Template-GD Template-XML Template-Latex

These modules have corresponding projects in the old Subversion repository. You can check out the source code for any of the above projects like so:

$ svn co svn://svn.tt2.org/tt/Template-DBI/trunk Template-DBI

Editor Bundles

Top Close Open

TextMate

A TT bundle for TextMate is available. This is version 0.02 which has full support for TT2. including syntax highlighting and a number of auto-completion snippets for generating TT code fragments. It also has limited support for the forthcoming TT3 template language. Language definitions are provided for TT2/TT3 in stand-alone files, or embedded in HTML (HTML + TT2, HTML + TT3). Textmate-TT-0.02.tar.gz Textmate-TT-0.02.zip

Sublime Text 2

The Sublime Text 2 editor uses the same bundle format as TextMate so you can use the TextMate bundles above. Simply unpack the download archive and drag the Template Toolkit.tmbundle folder to ~/Library/Application Support/Sublime Text 2/Packages.

Emacs

Dave Cross has written an Emacs mode for TT, available here. It performs syntax highlighting, although he warns it can be a bit flaky at times (patches welcome). nXhtml is an addon to Emacs for editing XHTML, PHP and similar things. It includes Dave's Emacs mode and uses it in the multi major modes.

Kate: KDE Advanced Text Editor

Krassimir Berov has written a TT syntax highlighting extension for Kate. It's available here.

jEdit

jEdit has in-built support for highlighting TT syntax.

Joe

Michael Holzt has written a TT syntax highlighting extension for the Joe editor. Download it from here.

Komodo

ActiveState's Komodo Edit and Komodo IDE both have built-in support for TT.

Vim

Atsushi Moriki has written a syntax highlight file for Vim. You can fetch it from here.

http://template-toolkit.org/download/index.html last modified 15:21:44 17-Sep-2014
Fork me on GitHub