E R wrote:
> <html>
> <head>
> [% INCLUDE header_stuff %]
> </head>
> <body>
>   ...
>   [% INCLUDE foo %]
>   ...
> </body>
> </html>
> 
> and you want the macro foo to do the following:
> 
> 1. emit some output at its location, and
> 2. add some text to the definition of header_stuff
> 
> For instance, foo might need some resource that you want loaded in the
> <head> section.

I believe you'd need to do something like this unless you plan on 
post-processing the document:
-----------------------
<html>
<head>
[% head_items = {} %]
[% temp_holding = INCLUDE foo # this will create keys/values in head_items %]
[% ### look at head items hash and display the items you need ### %]
[% INCLUDE header_stuff %]
</head>
<body>
  ...
  [% temp_holding %]
  ...
</body>
</html>
-----------------------

The head_items hash is needed to get around the cloning done in INCLUDE. 
(Cloning is done at the top level only, so references aren't affected.) If you 
are ok with "foo"'s variables being imported into the current template, you can 
simply use PROCESS and not have to worry about head_items.

-- Josh

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to