0

I started learning Perl Catalyst and its awesome!!! However, I am having a little issue here with templateing.

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)

Grigor
  • 4,139
  • 10
  • 41
  • 79

2 Answers2

4

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

szabgab
  • 6,202
  • 11
  • 50
  • 64
thealexbaron
  • 1,558
  • 1
  • 11
  • 25
  • I have a view called HTML but I don't get what it has to do with the template because the name is not included anywhere. – Grigor Apr 11 '13 at 05:19
  • 1
    Follow the tutorial I linked you to. It will guide you through precisely what you want to do. – thealexbaron Apr 11 '13 at 16:16
1

You cannot pass 2 templates in stash.Only the last value will be kept.However the to way to do this, is to include the footer template inside the header.The commands include and process are very helpfull.

Fotis_zzz
  • 150
  • 1
  • 10