On Nov 3,  9:52am, Ken Y. Clark wrote:
> btw, i'd really recommend you look into using Template Toolkit.

Indeed.  One of the nice things about TT (in the author's humble opinion)
is that you can use the same presentation templates to render static HTML
as for dynamic HTML.

For example, you can create a template which uses the DBI plugin to
access some data and display it nicely (see the other thread on "a web
interface to visualize tables").

e.g.

   [% INCLUDE header
      title = "Some Funky Data" %]

   [% USE DBI(dsn) %]
   [% USE Table(DBI.query('SELECT * FROM blah'), rows=10) %]
   <table>
   [% FOREACH row = Table.rows %]
   <tr>
     [% FOREACH item = row %]
     <td>[% item %]</td>
     [% END %]
   </tr>
   [% END %]
   </table>

   [% INCLUDE footer %]

You can deliver this page from Apache/mod_perl to have it constructed
on-the-fly, or you can use 'tpage' or 'ttree' (distributed with the
Template Toolkit) to create the content offline as a static page.
Both dynamic and static pages can shared the same presentation elements
(e.g. header/footer in this example), and both have full access to the
TT plugins to fetch DBI data, display tables, etc.

'ttree' is your friend.  You can define as many templates like this as
you like, stuff them all in a directory somewhere, setup a ttree config
file, and then just call 'ttree -f my_config_file' to have it process
all and any such templates and copy the output to your static HTML
directory.

See the copious TT documentation (perldoc ttree, perldoc Template) for
further info.  The TT web site also has my paper from TPC4 which
discusses these techniques at greater length.

  http://www.template-toolkit.org/

HTH
A


-- 
Andy Wardley <[EMAIL PROTECTED]>   Signature regenerating.  Please remain seated.
     <[EMAIL PROTECTED]>   For a good time: http://www.kfs.org/~abw/

Reply via email to