Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Catalyst Template::Toolkit render output

I'm using Catalyst with Template::Toolkit as my templating system. I would like to be able to render specific parts of templates and then have them returned to me so I can store them in a variable. The Template::Toolkit documentation mentions that you can do that like this:

my $content = $c->forward($c->view('HTML'), "render", $template_name);

However, whenever I do this I just get this error:

file error - : not found

Does anyone know what I'm doing wrong? Thanks!

like image 253
srchulo Avatar asked Feb 20 '13 01:02

srchulo


1 Answers

$c->forward( $class, $method, [, \@arguments ] ) - is right syntax for forward method from Catalyst

Therefore you should write like this:

my $content = $c->forward($c->view('HTML'), "render", [ $template_name ]);

like image 179
edem Avatar answered Oct 12 '22 13:10

edem