[Templates] How to insert tags in string

Jonas Liljegren jonas@paranormal.se
Mon, 14 Aug 2000 17:11:24 +0200 (CEST)


On Mon, 14 Aug 2000, Andy Wardley wrote:

> It's uncanny.  I was thinking about this very problem in the shower this
> morning.  And it's not the first time that Jonas has pre-empted my thoughts
> in this way, either....   (hears X-Files music).

You could even say it's paranormal. :-)


I have spent som time trying to provoke diffrent errors. I got things
like:

[Mon Aug 14 16:53:05 2000] [error] Fatal template error: file error -
parse error: input text line 1-2: unexpected token ("parse)
  [% box( message="parse error: main_preview.html line 17: unexpected
token (1)
  [% FOREACH i = {1, 2, 3} %]


This comes from trying to embedding the error response in a minitemplate
and parse it with eval. Anb because that failed, The above error was sent
to the errer log as a last resort.






I got the stash error from this template code (because of that '$'):

[% FOREACH key = cgi.param() %]
 - [% cgi.param($key) %]
[% END %]


Not an ARRAY reference at
/opt/perl-5.6.0/lib/site_perl/5.6.0/Template/Stash.pm line 191.



I'm not quite happy with the error handling. I will try to describe what I
have done and see if any of you can come up with a better solution.



-- 
/ Jonas  -  http://jonas.liljegren.org/myself/en/index.html