Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Overriding Apache::Template postprocessing directive within a specific TT2 file

by jbullock35 (Hermit)
on Dec 15, 2008 at 23:59 UTC ( #730538=perlquestion: print w/replies, xml ) Need Help??
jbullock35 has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on a server that is running Template Toolkit 2.14 and Apache::Template. The Apache .conf files, which I cannot edit, include the directive

    TT2PostProcess FOOTER

which appends the file FOOTER to every TT2 file that is served by Apache.

This is almost always what I want. But there is one particular TT2 file, special.tt2, for which I don't want FOOTER to be appended. Can I place a command in special.tt2 to ensure that FOOTER won't be appended?

Replies are listed 'Best First'.
Re: Overriding Apache::Template postprocessing directive within a specific TT2 file
by Your Mother (Bishop) on Dec 16, 2008 at 00:57 UTC

    I think you can do it this way, not sure if it's the best. Untested and I've never tried to do this but it might be right. The trick is you have to put it in the footer template file, at the very top.

    [% RETURN IF EQ "special.tt2" %]

    Something like this is okay if it's a single hack but it tends to point to an underlying design flaw. Probably it would be better to assign the footer based on some datapoint from inside the controller code rather than tacking it onto everything that comes out of the executable.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://730538]
Approved by Tanktalus
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2018-03-22 08:45 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (273 votes). Check out past polls.