Tags:
create new tag
view all tags

Pattern Skin Using Template Toolkit

To explore benefits offered by Template Toolkit, here is an effort to use TT2 to render the topics.

It currently only loads and processes the tt2 template file for view. The pattern skin has been converted to TT2 format. TMPL:DEF's are converted into TT2 BLOCKs.

The algorithm is roughly:

  • Load the standard template - in this case ttview.pattern.tmpl
  • Some standard replacements as per original code (such as REV's).
  • Instantiate and process it as TT2 template. This step requires set of values to be passed to the TT2 engine - so they are available for use within the templates. For e.g. [% web %] will be replaced with name of the web. (These are equivalent to twiki variables.) Only a sample list of variables in currently provided; but none are used in pattern skin.
  • Finally pass it on to standard renderer which replaces common tags and twiki variables.

From included README:

$ cat TT2Templates.README
This is an experimental version to use Template Toolkit in lieu of the main templating system that twiki supports today.

What has been done:
 - Convert pattern skin view template  (view.pattern.tmpl) to Template toolkit template: ttview.pattern.tmpl. (For loading these templates, existing mechanism is used.)
 - For now, in lieu of TMPL:INCLUDE capability, the files are directly inserted. Therefore, we include converted 'twiki.tmpl' in ttview.pattern.tmpl.
 - A new 'view' called 'ttview', that in turn uses a new lib/TWiki/UI/TTView.pm is used.

To install:
 - Untar it somewhere, copy the files to relevant locations
 - Default twiki setup is not affected unless configuration changes as made as suggested below.


To test it for single topic: Directly use 'ttview' in place of 'view' in the URL of topic.

To use it for all topics by default:
 - Change $dispViewPath definition to "/ttview".

Note: You need to install Template toolkit first. (http://www.template-toolkit.org/)

-- VinodKulkarni - 20 Mar 2005

Very interesting, Vinod.

Any sense of the relative performance of TT wrt TWiki's system?

-- MartinCleaver - 20 Mar 2005

I am out of touch w.r.t. performance measurement setup. But because it is a drop-in replacement, it should be easy to compare... Let us hear from community.

-- VinodKulkarni - 20 Mar 2005

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatgz TT2Templates-0.1.tar.gz r1 manage 7.7 K 2005-03-20 - 14:53 UnknownUser Pattern skin using TT2 Templates
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2005-03-20 - VinodKulkarni
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.