[dancer-users] Setting title in autopage mode

Sawyer X xsawyerx at gmail.com
Mon Jan 12 20:34:50 GMT 2015

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.

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.

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.

Then you can set META variables in order to control variables that will be
available in the wrapper (layout) layer.

Here's the entry in the cookbook:

Since the auto pages render templates, this would work in them too.

On Mon, Jan 12, 2015 at 4:19 PM, Gabor Szabo <gabor at szabgab.com> wrote:

> Hi,
> if a website - such as the http://perldancer.org/ uses auto_page: 1 in
> the configuration
> it means you don't need to create a route for each template, if a page
> called /xyz  is
> requested then, if there is a views/xyz.tt then that file will be served
> in the main layout.
> The question: how can I set the title (which is in the layout) of such
> page?
> I tried to add
> <% title="abc" %> to the views/xyz.tt file but it did not have an impact.
> Is it possible? How?
> Gabor
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150112/1db3c69b/attachment.html>

More information about the dancer-users mailing list