in reply to Re^3: How? Use new() from HTML::Template
in thread How? Use new() from HTML::Template
I've renamed that placeholder from <TMPL_VAR NAME="PERLCODE"> to <RECAPTCHA>.Now it's not an HTML::Template placeholder so H::T won't know what it is.
Change your template placeholder to <TMPL_VAR NAME="html">.use HTML::Template; use Captcha::reCAPTCHA; my $c = Captcha::reCAPTCHA->new; my $html = $c->get_html('your public key here'); my $t = HTML::Template->new(scalarref => \$template_file); $t->param(html => $html); $output = $t->output;
Untested.
You can't put Perl code in a H::T template. That, imo, is A Good Thing. Keep all the code in your script and leave H::T to look after the presentation (the view).
It's worth having a good read of the docs. While you can't put code in the template there are some nifty things you can do that will make your life a lot easier.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How? Use new() from HTML::Template
by newbie00 (Beadle) on Jul 26, 2010 at 05:29 UTC |