r3 - 20 Mar 2005 - 18:28:42 - VinodKulkarniYou are here: TWiki >  Codev Web > PatternSkinUsingTT2Templates
Tags:
, create new tag

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 Action Size Date Who Comment
elsegz TT2Templates-0.1.tar.gz manage 7.7 K 20 Mar 2005 - 14:53 VinodKulkarni Pattern skin using TT2 Templates
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo