[Templates-cvs] cvs commit: TT3/examples/templates example.html header header.htmlt htmltemplate

cvs@template-toolkit.org cvs@template-toolkit.org
Sat, 11 Dec 2004 13:57:38 +0000


cvs         04/12/11 13:57:38

  Added:       examples/templates example.html header header.htmlt
                        htmltemplate
  Log:
  * added new examples and test templates
  
  Revision  Changes    Path
  1.1                  TT3/examples/templates/example.html
  
  Index: example.html
  ===================================================================
  [% message %]
  
  This is the first template ever processed by the all-new Template
  Toolkit Version 3.
  
  At the time of writing, TT3 is far from complete.  Most of the core
  architecture is in place, and we now have a front-end Template module
  that completes the circle, allowing us to process a template and have
  it all "just work" behind the scenes.  Previously we have only been
  able to test the core components in isolation, or as discrete
  sub-systems (e.g. the compiler).
  
  However, it is worth noting that most things "just don't work" right
  now.  Only half the directives are implemented (some old, some new),
  there's no filters, the virtual methods are there but aren't yet
  plugged into the architecture, and there's no service layer at all (so
  no pre-processed or post-processed templates).  There's plenty more
  still to do, but we're well on the way.
  
  So here's some examples of what you can do:
  
  [% INCLUDE header 
        title  = "$message (example template)"
        author = 'Andy Wardley'
  %]
  
  
  
  
  
  1.1                  TT3/examples/templates/header
  
  Index: header
  ===================================================================
  [% MY foo = 'private foo variable' %]
  This is the header file.
  The message is '[% message %]'.
  The title is '[% title %]'.
  The author is '[% author %]'.
  Foo is a [% foo %]
  
  
  
  
  1.1                  TT3/examples/templates/header.htmlt
  
  Index: header.htmlt
  ===================================================================
  <TMPL_VAR NAME="message">.
  This is the header file.
  x is set to <TMPL_VAR NAME="x"/>
  
  
  
  1.1                  TT3/examples/templates/htmltemplate
  
  Index: htmltemplate
  ===================================================================
  <TMPL_INCLUDE NAME="header.htmlt" x="10">
  
  The message is <TMPL_VAR NAME="message">.
  
  <TMPL_IF NAME="interesting">
     I am <TMPL_VAR NAME="interesting"> interesting.
  <TMPL_ELSE>
     I am very boring.
  </TMPL_IF>
  
  The good thing is that we're using the underlying TT parser,
  so we can use dotted variables, call subroutines, pass arguments,
  and so on.
  
  myhash.x is <TMPL_VAR NAME="myhash.x">
  myhash.y.z is <TMPL_VAR NAME="myhash.y.z">
  
  mycode(myhash.x, myhash.y.z, 300) is: 
    <TMPL_VAR NAME="mycode(myhash.x, myhash.y.z, 300)">