<div dir="ltr">The way template rendering works in Dancer (and I know you know this, but I need to set the ground for the explanation) is that it will render the template, then separately render the layout with the rendered template as the "content" in the layout.<div><br></div><div>The problem with this is that these two are not connected. The reason is also because it was built for template systems that don't support layouts. However, some of them do.</div><div><br></div><div>Template Toolkit supports the WRAPPER option for layouts. You can ask Dancer to not serve a layout and then ask Template Toolkit to use the WRAPPER method to render the content in a layout.</div><div><br></div><div>Then you can set META variables in order to control variables that will be available in the wrapper (layout) layer.</div><div><br></div><div>Here's the entry in the cookbook:</div><div><a href="https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Cookbook.pod#Template-Toolkits-WRAPPER-directive-in-Dancer2">https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Cookbook.pod#Template-Toolkits-WRAPPER-directive-in-Dancer2</a><br></div><div><br></div><div>Since the auto pages render templates, this would work in them too.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 12, 2015 at 4:19 PM, Gabor Szabo <span dir="ltr"><<a href="mailto:gabor@szabgab.com" target="_blank">gabor@szabgab.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>if a website - such as the <a href="http://perldancer.org/" target="_blank">http://perldancer.org/</a> uses auto_page: 1 in the configuration</div><div>it means you don't need to create a route for each template, if a page called /xyz  is</div><div>requested then, if there is a views/<a href="http://xyz.tt" target="_blank">xyz.tt</a> then that file will be served in the main layout.</div><div><br></div><div>The question: how can I set the title (which is in the layout) of such page?</div><div>I tried to add </div><div><% title="abc" %> to the views/<a href="http://xyz.tt" target="_blank">xyz.tt</a> file but it did not have an impact.</div><div><br></div><div>Is it possible? How?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Gabor</div><div><br></div><div>
</div></font></span></div>
<br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>