To date I've only used TT for generating dynamic output from CGIs (primarily Bugzilla). I'm now considering it as a replacement for a simple homegrown web site templating system. Is there a set of best practices (file naming conventions, directory structures, etc.) recorded anywhere to guide me through this process?

On a more specific note: the current site consists of complete web pages which the templating system munges together with the templates to produce the final pages, i.e. something like:

Document:

<html>
 <head>
   <title>My Page</title>
 </head>
 <body>
   the content...
 </body>
</html>

Template:

<html>
 [% contents of head tag from document %]
 <body>
   [% INCLUDE header (title bar, navigation, etc.) %]
   [% content %]
   [% INCLUDE footer (modification date, copyright notice, etc.) %]
 </body>
</html>

Result:

<html>
 <head>
   <title>My Page</title>
  </head>
 <body>
   header (title bar, navigation, etc.)
   the content...
   footer (modification date, copyright notice, etc.)
 </body>
</html>


It seems like the right thing to do in TT is to define a wrapper and put only the content in the document, i.e.:


Document:

[% page_title = "My Page" %]
the content...

Wrapper Template:

<html>
<head>
 <title>[% page_title %]</title>
</head>
 <body>
   [% INCLUDE header (title bar, navigation, etc.) %]
   [% content %]
   [% INCLUDE footer (modification date, copyright notice, etc.) %]
 </body>
</html>

Result:

<html>
<head>
 <title>My Page</title>
</head>
 <body>
   header (title bar, navigation, etc.)
   the content...
   footer (modification date, copyright notice, etc.)
 </body>
</html>

I'm worried that this change breaks source document validation, which works under our current arrangement. Am I wrong to worry (i.e. validators do well enough), is the TT approach worth it anyway, or is there a better TT approach that resolves this conflict?

-myk


_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to