Template2 icon indicating copy to clipboard operation
Template2 copied to clipboard

EXPOSE_BLOCKS not documented

Open johnhorner opened this issue 5 years ago • 2 comments

It doesn't appear that EXPOSE_BLOCKS is documented anywhere on the http://www.template-toolkit.org/ site. The only place to find out about it is in the O'Reilly book.

johnhorner avatar Apr 19 '19 04:04 johnhorner

Ok do you want to give us a summary of what you now understand? Or maybe a patch?

toddr avatar Apr 19 '19 15:04 toddr

I guess I would add to this page:

http://www.template-toolkit.org/docs/manual/Config.html

In this section:

http://www.template-toolkit.org/docs/manual/Config.html#section_Template_Files_and_Blocks

something like:

Normally a block is only processed as part of the template in which it's contained. The expose_blocks option allows you to process a block in isolation, using the following syntax:

[% PROCESS <templatename>/<blockname> %]   For example if you had a navbar block defined in your header.tt and wanted to render the same navbar in some other context without the surrounding header code, you could use expose_blocks and then

[% PROCESS header/navbar %]

johnhorner avatar Apr 20 '19 02:04 johnhorner