perlcatalyst

Perl Catalyst, pass to stash 2 template parts


I started learning Perl Catalyst and it's awesome!!! However, I am having a little issue here with templating.

I am trying to pass two template variables to the page (header and footer), what I did in the Controller function is

$c->stash(template => 'header.html');
//other page contents
$c->stash(template => 'footer.html');

but this only outputs the footer.html (which it should and seems logical)

What would be the way for this approach? I searched google but could not find many helpful results (at least results that I could understand and use)


Solution

  • You need to create a view.

    https://metacpan.org/pod/Catalyst::Manual::Tutorial::02_CatalystBasics#Hello-World-Using-a-View-and-a-Template

    Also, have a look at how wrappers work in TT -- they are really cool.

    http://www.template-toolkit.org/docs/manual/Directives.html#section_WRAPPER