--- darren chamberlain <[EMAIL PROTECTED]> 

> 
>       use Template;
>       use File::Find;
>       my $t = Template->new(
>                 INCLUDE_DIR => "/web/templates",
>                 COMPILE_DIR => "/var/ttcache",
>                 OUTPUT      => "/dev/null",
>               );
> 
>       sub process {
>         $t->process($_, { }) or warn $t->error;
>       }
> 
>       find(\&process, "/web/htdocs");
> 
>     These templates will now be precompiled in
>     /var/ttcache/web/templates, which is where the
> Template::Provider
>     objects will look for them at runtime.

darren,

Thank you *very* much for this info. I am thankful
that someone has taken the time to put this togther!

However, I'm unclear what the difference is between
"/web/templates" and "/web/htdocs". I also pass vars
to my process and I'm not sure from your doc how to do
this (though see my example later).

My original setup...

My templates are located in:

/usr/local/upuzzles

and lib items in

/usr/local/upuzzles/lib

And my handler:

# $websrc = '/usr/local/upuzzles'
my $template = Template->new({
        INCLUDE_PATH  => "$websrc:$websrc/lib",
        ABSOLUTE      => 1,
        RELATIVE      => 1,
        OUTPUT        => $r,  
});

my $params = {
   # params here
}

$template->process($file, $params)
  || error_msg($r, OK, $template->error());


I've tried changing like this:

my $template = Template->new({
        ABSOLUTE      => 1,
        RELATIVE      => 1,
        INCLUDE_DIR => "$websrc:$websrc/lib",
        COMPILE_DIR => "/var/ttcache",
        OUTPUT      => "/dev/null",

    });

my $params = {
    # params here
}

sub process {
    $template->process($_, $params)
      || error_msg($r, OK, $template->error());
}

# $websrc = '/usr/local/upuzzles'
find(\&process, "$websrc");

I'm sure my setup is wrong, but I haven't found how to
make it right yet.

I get no template output with OUTPUT => "/dev/null"
(though I can get the handler to print output). 

When I change to OUTPUT => $r (or comment it out), I
get very strange output, and it's very wrong. 

It looks like in both cases /var/ttcache isn't
building out sub directories
(/var/ttcache/usr/local/upuzzles/*), but instead is
putting all templates and lib items under the top
level directory of /var/ttcache


Are INLUDE_DIR and INCLUDE_PATH the same?

Sorry for all these questions, but this has been a
major issue with my TT launch...and the PHBs may want
to return to ColdFusion if I don't get this figured
out soon.

Thanks...

doug

__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com


Reply via email to