On Wed, 6 Aug 2003, dan wrote:
> I'm running TT 2.10 under IIS. I need to retrieve my CGI params and use the
> values in the calling CGI, then pass the values into the template. My Perl
> CGI code (test.pl) looks like:
>
> use Template;
> use CGI qw(:standard);
>
> $| = 1;
> print "Content-type: text/html\n\n";
>
> $cgi = CGI->new();
> %cgiArgs = $cgi->Vars;
>
> my $file = 'templates/test.tmpl';
> my $vars = {
> message => "Hello World",
> me => {
> 'name' => 'Dan',
> 'email' => '[EMAIL PROTECTED]',
> },
> cgi => %cgiArgs,
I think this needs to be a reference:
cgi => \%cgiArgs,
> };
>
> my $template = Template->new({
> INCLUDE_PATH => '/inetpub/wwwroot/workcomp',
> });
>
> $template->process($file, $vars) || die $template->error();
>
> And the template file I'm referencing contains:
>
> <HTML>
> <HEAD>
> <TITLE>Template test</TITLE>
> </HEAD>
> <BODY>
> [% me.name %] .. [% me.email %]
> <BR>
> [% message %]
> <P>
> <UL>
> [% FOREACH item = cgi.keys %]
> <li>[% item %] => [% cgi.$item %]
> [% END %]
> </UL>
> </BODY>
> </HTML>
>
> I'm calling the script as http://<server IP>/<directory>/test.pl?a=1&b=2&c=3
> and based upon what I read in Template::Manual::Variables and
> Template::Manual::VMethods, I expected to see my 3 CGI parameters displayed.
> I see the "me" and "message" elements ok, but no CGI params. What's my
> error?
>
> --------------------------
> Dan Mahoney
> [EMAIL PROTECTED]
> AA6GF
>
> "How you behave towards cats here below determines your status in Heaven."
> Robert Heinlein
>
> "There are two means of refuge from the miseries of
> life - music and cats" - Albert Schweitzer
>
>
> _______________________________________________
> templates mailing list
> [EMAIL PROTECTED]
> http://lists.template-toolkit.org/mailman/listinfo/templates
>
Dave
/L\_/E\_/A\_/R\_/N\_/T\_/E\_/A\_/C\_/H\_/L\_/E\_/A\_/R\_/N\
Dave Cash Power to the People!
Frolicking in Fields of Garlic Right On-Line!
[EMAIL PROTECTED] Dig it all.
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates