On Wed, 8 May 2013 17:05:58 -0700 (PDT)
Summer <crazysummer2...@yahoo.com> wrote:

> well, it won't work that way because I am using it as an anonymous
> block.. ie.
> 
> [%
> some_name = BLOCK;
>  # ton of data
> END;
> %]
> 
> 
> If I try to call it like so: PROCESS some_name, I get a stack trace
> which complains about that block not existing.
> 
> The way you propose would be the standard block declaration:
> 
> BLOCK some_name;
> 
> END;
> 
> That will work, but the problem is I don't want to process all that
> info again. I want to process it once then display that output 'n'
> number of times... except one of those times, I want some data
> omitted.

Using it that way means you're working with a string (the output of the
block has been stored as a string in some_name).  If you want to omit
something from that string, you'll have to strip it out, perhaps using
regular expressions...  Or just split the original output into separate
variables, some with the parts you always want and other(s) with the
part(s) you want only sometimes and output them conditionally as needed.



>  From: Larry Leszczynski <lar...@emailplus.org>
> To: templates@template-toolkit.org 
> Sent: Wednesday, May 8, 2013 4:49 PM
> Subject: Re: [Templates] somevar = BLOCK and passing switches
>  
> 
> Hi Summer - 
> 
> > [% some_name; token_to_omit =1 %]
> > 
> > some_name does not respect that variable "token_to_omit"
> 
> Did you try:
> 
> [% PROCESS some_name token_to_omit=1 %]
> 
> (No semicolon after "some_name".)
> 
> http://www.template-toolkit.org/docs/manual/Directives.html#section_BLOCK
> 
> 
> HTH,
> Larry
> 
> _______________________________________________
> templates mailing list
> templates@template-toolkit.org
> http://mail.template-toolkit.org/mailman/listinfo/templates


-- 

C. Chad Wallace, B.Sc.
The Lodging Company
http://www.lodgingcompany.com/
OpenPGP Public Key ID: 0x262208A0


_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to