Corey Saltiel wrote:
I'm trying to do something like this:
In a perl script/controller:
<snip>
$tt_vars->{'shnarf'} = 'HELLO';
$tt_vars->{'params'} = 'foo=bar&blah=[%shnarf%]';
$tt_vars->{'controller'} = 'snafu.pl';
Then in a tt:
<a href="[%controller%]?[%params%]">
Hoping to get:
http://snafu.pl?foo=bar&blah=HELLO
But instead I get:
http:://snafu.pl?foo=bar&blah=[%25shnarf%25]
The same happens ( for whetever reasons ), when I try:
$tt_vars->{'params'} = 'foo=bar&blah=[%shnarf%]';
HOWEVER... when I do:
$tt_vars->{'params'} = 'foo=bar&blah=[<shnarf<]';
I get:
http:://snafu.pl?foo=bar&blah=[<shnarf<]
... as I would expect.
Any ideas why the percentage escape ( % ) isn't working the way the other
escapes do?
But more importantly - how do I get the behavior I'm looking for?
( i.e. "http://snafu.pl?foo=bar&blah=HELLO" )
I'm doing this to make a particular template more reusable in a variety of
contexts.
Many thanks!
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates
Hi Corey,
I think you may just need to tell TT to process the params variable for any TT
stuff it may have in it, since I don't think it does that by default.
Try this:
<a href="[% controller %]?[% params | eval %]">
with your original:
$tt_vars->{'params'} = 'foo=bar&blah=[% shnarf %]';
-- Josh
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates