Re: [Templates] Calling BLOCKS inside templates
[prev]
[thread]
[next]
[Date index for 2005/03/05]
Hi Buddy,
Why don't you just use: [% PROCESS my_template.tt2 %] to include your
blocks into your pages? Then just process them as normal like:
[% PROCESS bar %]. If you put only blocks in my_template.tt2 there
should be no problem.
-- Josh
Buddy Burden wrote:
> Guys,
>
> Okay, I'm sure someone must have solved this before ...
>
> I'm using several BLOCKs inside my various templates, and occasionally I
> need to get the output of just a BLOCK (as opposed to the whole
> template). Naturally, my solution was to expose the blocks via the
> EXPOSE_BLOCKS config option (which, BTW, doesn't appear to be in the
> online doco; I found it while perusing the badger book).
>
> So this works well for most of my problems, but the problem arises when
> I have something like:
>
> [%# my_template.tt2 %]
>
> [% BLOCK foo %]
> some stuff
> [% END %]
>
> [% BLOCK bar %]
> [% PROCESS foo %]
> other stuff
> [% END %]
>
> and then I try to process my_template.tt2/bar. Now, obviously I can see
> _why_ it doesn't work; makes perfect sense in fact. What I want to know
> is is there any way around it? I looked briefly at the AUTO_RESET
> config option, but it sorta frightened me: I got the feeling that was
> one of those things you don't mess with unless you really know what
> you're doing.
>
> So does anyone have any suggestions? I'm not particularly tied to
> EXPOSE_BLOCKS, but I really want to avoid making each separate block its
> own separate template; that would get messy, and it would confuse the
> hell out of my HTML person (who is more of a layout designer than a
> programmer).
>
> TIA.
>
>
> -- Buddy
>
> _______________________________________________
> templates mailing list
> templates@xxxxxxxxxxxxxxxx.xxx
> http://lists.template-toolkit.org/mailman/listinfo/templates
>
> !DSPAM:42290866303787271584597!
>
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
 |
(message missing)
|