QaR QaR wrote:
> I'm using Template Toolkit for the first time and I would really
> appreciate some help with the following question:
>
> I'm sending the request object in the handler, like this:
> my $r = shift;
> my $request = Apache2::Request->new($r);
> my %vars = (request => $request,...);
> $TT->process($file_path, \%vars, $r) || return error($r,$TT->error( ))
>
> And then, in the template, I do the following to access the request object:
> [%RAWPERL%]my $request = $stash->get('request');[%END%]
>
> I know it's working because I can get the parameters from the request
> object by doing this:
> [%RAWPERL%]
> my $request = $stash->get('request');
> my $param1 = $request->param('param1');
> $output .= $param1;
> [%END%]
>
> But I'm not sure if I'm doing this the right way.
>
> I really would appreciate any help.
You could simply do: [% request.param('param1') %]. I'd suggest reading the
docs as they can be very helpful:
http://template-toolkit.org/docs/manual/index.html
Your question is answered pretty much here:
http://template-toolkit.org/docs/manual/Intro.html#section_Data_and_Code_Binding
-- Josh
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates