The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Dancer2::Template::Xslate - Text::Xslate template engine for Dancer2

SYNOPSIS

config.yaml:

    template: Xslate

A Dancer 2 application:

    use Dancer2;

    get '/page/:number' => sub {
        my $page_num = params->{number};
        template "foo.tx", { page_num => $page_num };
    };

If you want to use cascading templates to manage page layouts make sure you disable Dancer2 layouts.

In config.yaml, comment the layout keyword:

    # The default layout to use for your application (located in
    # views/layouts/main.tt)
    # layout: "main"

If you don't, Dancer2 will render your template and then render the layout template. If your layout template doesn't have the content placeholder only the layout HTML will be returned.

METHODS

render($template, $tokens)

Renders a template. $template can be one of:

  • a string of the path to a template file (*.tx, not *.tt like the core Dancer2 template engines)

  • a reference to a string containing prerendered template content

SEE ALSO

Dancer::Template::Xslate

Xslate rendering engine for Dancer 1.

AUTHOR

Richard Simões <rsimoes AT cpan DOT org>

COPYRIGHT AND LICENSE

Copyright © 2013 Richard Simões. This module is released under the terms of the MIT License and may be modified and/or redistributed under the same or any compatible license.