[Dancer-users] get template command to ignore layout

David Holden dvdhldn at gmail.com
Tue Aug 3 12:56:02 CEST 2010


Hi Dave,

 Thanks! I'll also look into Dancer::Serializer.

Cheers,

 Dave.


On 3 August 2010 11:48, David Precious <davidp at preshweb.co.uk> wrote:
> On Tuesday 03 August 2010 11:19:25 David Holden wrote:
>> Hello, I was wondering is it possible to get the template command to
>> ignore the layout, e.g.
>>
>> here I want it to use the layout
>>
>>     template 'index' => $tt2_ds;
>>
>> but here
>>
>>    template 'table_result' => $tt2_ds;
>>
>> I want it to just return the template contents alone,
>
> Indeed it is - the template keyword takes a third param which is a hashref of
> options - you can disable the layout there with:
>
> template 'table_result => $tt2_ds, { layout => undef };
>
> This wasn't particularly clearly documented, but will be with the next Dancer
> release, as I already added a direct mention of it to the docs a few days ago:
>
> http://github.com/sukria/Dancer/commit/99f35be4be22d188df0fda7101e6e5cf280c3ff6
>
>> i.e. not wrapped
>> by the layout - for an ajax response.
>
> For that kind of thing, you might want to look at Dancer::Serializer to take
> care of serialising data (that sounds like what you're trying to do)
>
> Cheers,
>
> Dave P
>
> --
> David Precious <davidp at preshweb.co.uk>
> http://blog.preshweb.co.uk/    www.preshweb.co.uk/twitter
> www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
> www.preshweb.co.uk/identica    www.lyricsbadger.co.uk
>
>  "Programming is like sex. One mistake and you have to support
>  it for the rest of your life". (Michael Sinz)
>


More information about the Dancer-users mailing list