Dancer Noob => interpolating variables
Hello. I am starting with dancer. Installed, run dancer -a, and changed a template to include some variables: .. <div><% sidebar %></div> .. And in the rule, I have get '/' => sub { template 'index' => { 'sidebar' => 'bar', }; }; But the template is, still, empty. I am not sure where to debug this.. any hint will be welcome :) Alberto
ambs wrote:
Hello.
I am starting with dancer. Installed, run dancer -a, and changed a template to include some variables:
.. <div><% sidebar %></div> ..
And in the rule, I have
get '/' => sub { template 'index' => { 'sidebar' => 'bar', }; };
Try template 'index', { sidebar => 'bar' };
But the template is, still, empty. I am not sure where to debug this.. any hint will be welcome :) Alberto _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
-- Puneet Kishor http://punkish.org Carbon Model http://carbonmodel.org Charter Member, Open Source Geospatial Foundation http://www.osgeo.org Science Fellow http://creativecommons.org/about/people/fellows#puneetkishor Nelson Institute, UW-Madison http://www.nelson.wisc.edu --------------------------------------------------------------------------- Assertions are politics; backing up assertions with evidence is science ===========================================================================
On 14/12/2010 20:37, Puneet Kishor wrote:
ambs wrote:
Hello.
I am starting with dancer. Installed, run dancer -a, and changed a template to include some variables:
.. <div><% sidebar %></div> ..
And in the rule, I have
get '/' => sub { template 'index' => { 'sidebar' => 'bar', }; };
Try
template 'index', { sidebar => 'bar' };
No, nothing (btw, the '=>' is just a comma, in Perl);
Kind of late, but... On Tue, Dec 14, 2010 at 10:40 PM, ambs <ambs+dancer@perl-hackers.net<ambs%2Bdancer@perl-hackers.net>
wrote:
No, nothing (btw, the '=>' is just a comma, in Perl);
It's even called "fat comma" to signify that it's basically a comma. :)
On 14/12/2010 20:35, ambs wrote:
Hello.
I am starting with dancer. Installed, run dancer -a, and changed a template to include some variables:
.. <div><% sidebar %></div> ..
And in the rule, I have
get '/' => sub { template 'index' => { 'sidebar' => 'bar', }; };
But the template is, still, empty. I am not sure where to debug this.. any hint will be welcome :)
I am running it under Fastcgi. An apache restart was needed. Probably a good idea to stick to the standalone server while in development :) Cheers ambs
Hi Alberto
I am running it under Fastcgi. An apache restart was needed. Probably a good idea to stick to the standalone server while in development :)
yup, stick with the standalone server while in development. You can choose the one provided by Dancer, or use plackup (plackup bin/app.pl) if you plan to deploy with Plack.
participants (4)
-
ambs -
franck -
Puneet Kishor -
sawyer x