That is because the default delimiters for Template toolkit are [% and %]
You have two choices :
uncomment the start and end tag definitions in your config to <% and %>
template: "template_toolkit"
engines:
template:
template_toolkit:
start_tag: '<%'
end_tag: '%>'
or change the delimeters in views/index.tt and views/layouts/main.tt to use the template toolkit default.
i.e. <% to [% and %> to %]
Cheers
Tony
On 10/08/2015 14:33, Richard Reina wrote:
Thanks for any help.Yes, Dancer2 Template Toolkit is installed. Curiosly when I swithc back to simple template in config.yml the basic dancer app works. So I do not understand why it would not if TToolkit is installed. However, when I switch to TToolkit I continue to get this in my browser:
<% content %> Here is the output from the console.
richard@gemini:~/Dancer2/MyApp$ plackup -r bin/app.psgi
Watching bin/lib bin/app.psgi for file updates.
HTTP::Server::PSGI: Accepting connections at http://0:5000/
[MyApp:2230] core @2015-08-10 07:47:43> looking for get / in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180
[MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.app.before_request in (eval 78) l. 1
[MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.app.after_request in (eval 78) l. 1
127.0.0.1 - - [10/Aug/2015:07:47:43 -0500] "GET / HTTP/1.1" 200 835 "-" "Mozilla/5.0 (X11; Linux i686; rv:39.0) Gecko/20100101 Firefox/39.0"
[MyApp:2230] core @2015-08-10 07:47:43> looking for get /<% request.uri_base %>/css/style.css in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180
[MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.init in (eval 78) l. 1
[MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.before in (eval 78) l. 1
[MyApp:2230] core @2015-08-10 07:47:43> Entering hook core.error.after in (eval 78) l. 1
127.0.0.1 - - [10/Aug/2015:07:47:43 -0500] "GET /%3C%%20request.uri_base%20%%3E/css/style.css HTTP/1.1" 404 522 "http://0:5000/" "Mozilla/5.0 (X11; Linux i686; rv:39.0) Gecko/20100101 Firefox/39.0"
[MyApp:2230] core @2015-08-10 07:52:35> looking for get / in /home/richard/perl5/lib/perl5/Dancer2/Core/App.pm l. 1180
[MyApp:2230] core @2015-08-10 07:52:35> Entering hook core.app.before_request in (eval 78) l. 1
[MyApp:2230] core @2015-08-10 07:52:35> Entering hook core.app.after_request in (eval 78) l. 1
127.0.0.1 - - [10/Aug/2015:07:52:35 -0500] "GET / HTTP/1.1" 200 835 "-" "Wget/1.13.4 (linux-gnu)"
Here is my ouput from wget.
<meta http-equiv="Content-type" content="text/html; settings.charset %>" />
richard@gemini:~/Dancer2/MyApp$ wget -O - http://0:5000/
--2015-08-10 08:32:23-- http://0:5000/
Resolving 0 (0)... 0.0.0.0
Connecting to 0 (0)|0.0.0.0|:5000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 835 [text/html]
Saving to: `STDOUT'
0% [ ] 0 --.-K/s <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MyApp</title>
<link rel="stylesheet" href="<% request.uri_base %>/css/style.css" />
<!-- Grab jQuery from a CDN, fall back to local if necessary -->
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript">/* <![CDATA[ */
!window.jQuery && document.write('<script type="text/javascript" src="<% request.uri_base %>/javascripts/jquery.js"><\/script>')
/* ]]> */</script>
</head>
<body>
<% content %>
<div id="footer">
Powered by <a href="http://perldancer.org/">Dancer2</a> <% dancer_version %>
</div>
</body>
</html>
100%[========================================================================================>] 835 --.-K/s in 0s
2015-08-10 08:32:23 (77.0 MB/s) - written to stdout [835/835]
Again, this is just the basic Dancer2 app created with: $: Dancer2 -a MyApp.
Here is my config.yml file.
# This is the main configuration file of your Dancer2 app
# env-related settings should go to environments/$env.yml
# all the settings in this file will be loaded at Dancer's startup.
# Your application's name
appname: "MyApp"
# The default layout to use for your application (located in
# views/layouts/main.tt)
layout: "main"
# when the charset is set to UTF-8 Dancer2 will handle for you
# all the magic of encoding and decoding. You should not care
# about unicode within your app when this setting is set (recommended).
charset: "UTF-8"
# template engine
# simple: default and very basic template engine
# template_toolkit: TT
#template: "simple"
template: "template_toolkit"
# engines:
# template:
# template_toolkit:
# start_tag: '<%'
# end_tag: '%>'
2015-08-07 18:06 GMT-05:00 Warren Young <wyml@etr-usa.com>:
On Aug 7, 2015, at 4:00 PM, Richard Reina <gatorreina@gmail.com> wrote:
>
> get this in the browser:
>
> <% content %>
> Powered by Dancer2 <% dancer_version %>
It looks like Dancer is not expanding the templates. Are you sure Template::Toolkit installed correctly?
Try “sudo cpanm Dancer2”, and see if it installs anything that wasn’t there before.
_______________________________________________
dancer-users mailing list
dancer-users@dancer.pm
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________
dancer-users mailing list
dancer-users@dancer.pm
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users