Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Template::Toolkit PRE & POST PROCESS

by Anonymous Monk
on Dec 17, 2009 at 06:25 UTC ( [id://813139]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

I am working with Template Toolkit & have found myself calling header & footer in almost every file I write (which is pretty annoying), so I thought why don't I use PRE & POST PROCESS???

but the problem is: I have few templates that doesn't need header & footer to be included.

Any solution would be greatly appreciated.

Replies are listed 'Best First'.
Re: Template::Toolkit PRE & POST PROCESS
by stefbv (Curate) on Dec 17, 2009 at 08:48 UTC

    A similar question and answer:

    http://mail.template-toolkit.org/pipermail/templates/2005-February/007239.html

    It's about wrapper templates but can be easily adapted to separate header and footer. Here is the content of the message:

    Andy Wardley Tue, 22 Feb 2005 08:36:21 +0000 Jonathan Tweed wrote: I have a template toolkit object that automatically adds a wrapper to the processed template. Is there any way to override this on a particular call to process so that the wrapper does not get added? You can use a META tag to disable it. For example, in your wrapper: [% IF template.naked; content; ELSE; content WRAPPER site/wrapper; END %] Then in your template you can add a tag like this to disable the WRAPPER: [% META naked=1 %]

      It works well, Thanks for your help

Re: Template::Toolkit PRE & POST PROCESS
by desemondo (Hermit) on Dec 17, 2009 at 09:00 UTC
    If you haven't created one already, do yourself a favour and make a template for yourself. rewriting the same code is bound to become annoying and frustrating...
Re: Template::Toolkit PRE & POST PROCESS
by Anonymous Monk on Dec 17, 2009 at 07:22 UTC
    Keep doing what you're doing

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://813139]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-23 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found