Perrin Harkins wrote:

On Fri, 2003-07-25 at 18:32, Christopher L. Everett wrote:

I wish to reuse various templates in toto between different URLs but
have different means of providing the information I fill the template with depending
on the uri.


So far, I've tried using TT2PluginBase and TT2ServiceModule directives
inside Location blocks inside my apache configuration file.



Well, here's a silly question: why are you using Apache::Template? I think it would be much easier to just write an apache handler and have it call Template than to try and bend Apache::Template into what you want.

In general, people use Apache::Template when they plan to have simple
templates that do things with plugins.  The service module idea exists,
but I doubt many people use it.

Heh, I was trying to do templates that would use custom plugins.  Then
I could vary the PLUGIN_BASE to get same named plugins obtaining their
data in slightly different ways.

For the record, I didn't think I was bending Apache::Template into anything. The docs flat out state Apache::Template is configurable at the directory
block level. Quoting directly from the Apache::Template documentation*:


> CONFIGURATION MERGING
> The Apache::Template module will now correctly merge multiple
> configurations for different virtual server and/or directories. > For example:
>
> PerlModule Apache::Template
>
> TT2PostChomp On
> TT2IncludePath /usr/local/tt2/shared
>
> <Location /tom>
> TT2IncludePath /home/tom/tt2
> TT2EvalPerl On
> </Location>
>
> <Location /dick>
> TT2IncludePath /home/dick/tt2
> TT2Trim On
> TT2PostChomp Off
> </Location>
>
> Here, all URI's starting '/tom' have an effective TT2IncludePath of:
>
> TT2IncludePath /usr/local/tt2/shared /home/tom/tt2
>
> and those starting '/dick' have:
>
> TT2IncludePath /usr/local/tt2/shared /home/dick/tt2
>
> Similarly, different options such as TT2PostChomp, TT2EvalPerl, etc.,
> should enabled/disabled appropriately for different locations.


but that's misleading at best. A quick scan of the Apache::Template Makefile.PL
shows that *all* the TT2* apache directives defined only operate at the global and
virtual server levels, as in:


#-- parsing/style options --
{ name => 'TT2Tags',
errmsg => 'tag style or start and end tags for template directives',
args_how => 'TAKE12',
req_override => 'RSRC_CONF',
},


and making RSRC_CONF into OR_ADD didn't help.

It's too bad. Being able to specify PLUGIN_BASE or SERVICE_MODULE by location
could be an elegant architecture for separating templates (content) from function.


Aside from that the only other problem would have been that A::T recycles the Apache
DirectoryRoot directive, and I'm not sure I wanted all my templates in a simgle
directroy tree ... I prefer to group files by application on my servers.


*A shout out to Chmrr on perlmoks for pointing out the inconsistency 'twixt the
docs and the Makefile.PL.



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

Reply via email to