[dancer-users] Template tags in skel and app

Rick Leir richard.leir at canadiana.ca
Thu Nov 5 14:39:21 GMT 2015


On Thu, Nov 5, 2015 at 7:00 AM, <dancer-users-request at dancer.pm> wrote:

>
> skel/ contains *our* templates for generating a new application. We use [%
> %] in our templates when we generate a new application. If we used all [%
> %] or <% %>, the tags for the sample app would get processed out when we
> generated a new application. So by having two sets of tags, we can use one
> set generating the app, and leaving the second set intact in the skeleton
> application.
>
> Good question :)  Does my answer make sense?
>
> Jason


Yes, and your answer might be 'authoritative' when some new user is trying
to figure this out and Google leads to here!
In addition, here is the config for layouts: the WRAPPER path.
template:   "template_toolkit"
charset: UTF-8
engines:
    template:
        template_toolkit:
          ENCODING: utf8
          INCLUDE_PATH: 'views'
          start_tag: '<%'
          end_tag:   '%>'
          WRAPPER: layouts/emails.tt

Then in app code, you can refer to a template using a layout like this:

   my $email_body = template( 'emails/activate.tt',
                               {
                                   real_name => $fields{ name },
                                   recipient => $fields{ name },
                               });

File locations:
views/emails/activate.tt
views/layouts/emails.tt
Cheers -- Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20151105/bbd3c6a4/attachment.html>


More information about the dancer-users mailing list