Hi,

I'm trying to find common development techniques when building a site with
TT.  Basically, how to layout the site to make it easy to develop on
different machines with different paths.  I want to keep things simple and
reasonably standard to the way the TT tutorial explains things.

I've got a simple static + cgi site.  The live site is built using ttree.
The source content is wrapped for every page by my ttree "process" template.
  
Besides having files that are just copied via ttree, I also have files that
I don't want wrapped in my normal page, such as .htaccess and cgi scripts.
Yet, I still want them processed by ttree so they can be configured with
physical directory locations, and database name, user, and password.

The entire site is under cvs.  A number of people will check out the site
and work on it on their own machines and local web servers.  If you do a
checkout you get:
          site  (top level directory)
             + tt_lib  ( the include path )
             + web_source


Issue 1:  Disabling page wrapping on my non-web pages.

Currently, In a source cgi scripts I do:

   [%- META noformat = 1 -%]
   #![%- perl -%] -Tw
   use strict;

   use constant data_file => '[% data_path %]/data.db';
   my $dbh = DBI->connect( '[% database.dsn %]', 
          '[% database.user %]', '[% database.password %]');
   ...

and in my wrapper script (process = wrapper in .ttreerc):

  [%- IF  template.noformat; PROCESS $template; ELSE; -%]
  [%- USE SubMenu -%]
  [%- sections = [] -%]
  [%- WRAPPER page; PROCESS $template FILTER submenu; END -%]
  [%- END -%]

This seems clunky.  The real pain is any templates that are pre_processed
before this must be careful not insert any blank lines.

Is there a better way?


Issue 2: Making the site build with ttree at different locations

What do people do to override configuration setting.  Again, I use ttree to
generate the site, and ttree does a pre_process = config.  I want "config"
to contain the settings where the real live site is, but I want an easy way
to override these when developing on a different machine.

All I can think of is in config do a [% PROCESS myconfig %] after setting
my standard paths, and then have a blank myconfig file in the live site,
and do *not* place myconfig under CVS.  Then when the site is checked out
by someone they just need to create their own "myconfig" file.

Related to that is the .ttreerc file.  I'd like to have a single config
file for paths for both ttree and Template-Toolkit.  I guess that's a
chicken and egg problem, but I throw that out in case anyone has a clever
setup.

So, any suggestions would be very helpful.

Thanks a bunch,


PS - ttree only checks the basename against "copy" expressions.  I had
cases where some files I wanted to copy where others I wanted to process,
but the basename was the same.  (one example: I had some index.html files
that were scripts).  It might be helpful to have a "copy_match_path" or
maybe look for .ttreerc files in each directory to process to override
existing "copy" settings.  Or maybe I'm asking too much from ttree and
should just write my own site generation script.



Bill Moseley
mailto:[EMAIL PROTECTED]


Reply via email to