[dancer-users] Disabling main layout

Kadir Beyazlı kadirbeyazli at gmail.com
Sun Sep 13 13:01:36 BST 2015


Hi Hermann,

I read and understood your method but following method offered by John
works for which you wrote is not good idea to use.
I am copying the comment existing at your link:

Since Dancer's native layout is disabled, this does not work:

 template('mytemplate', { ... }, { layout => 'some_other_layout' });   # NO GOOD

native layout is not disabled. I see that that main layout works for
other routes



On Sat, Sep 12, 2015 at 10:12 PM, Hermann Calabria <hermann at ivouch.com> wrote:
> Here's a recipe I created some time ago for setting different layouts for different routes, including no layout at all.
>
> http://stackoverflow.com/questions/18198270/more-than-one-layout-wrapper-with-dancer-and-templatetoolkit
>
> Sent from my mobile. Please excuse brevity & typos.
>
>> On Sep 12, 2015, at 11:49 AM, Kadir Beyazlı <kadirbeyazli at gmail.com> wrote:
>>
>> Hi John,
>>
>> Yes it worked as follow, thanks.
>>
>> template 'login', { path => param('requested_path') },  { layout => undef };
>>
>>> On Sat, Sep 12, 2015 at 9:33 PM, John J. McDermott, CPLP <jjm at jkintl.com> wrote:
>>> To unset it just for login, try
>>>
>>> get '/login' => sub {
>>>    template 'login', { path => param('requested_path') }, undef;
>>> };
>>>
>>> See
>>> http://search.cpan.org/~sukria/Dancer2-0.10/lib/Dancer2/Manual.pod#template
>>>
>>> I believe setting "layout" is global.
>>> --john
>>>
>>>
>>> On 9/12/2015 12:20 PM, Kadir Beyazlı wrote:
>>>
>>> Hi All,
>>>
>>> Following worked, but this time main layout was not loaded at other
>>> routes either.
>>> I want main layout not to be loaded for only /login route.
>>>
>>> get '/login' => sub {
>>>    set 'layout' => undef;
>>>    template 'login', { path => param('requested_path') };
>>> };
>>>
>>> On Sat, Sep 12, 2015 at 9:15 PM, Kadir Beyazlı <kadirbeyazli at gmail.com>
>>> wrote:
>>>
>>> Hi All,
>>>
>>> I tried following but it did not work, I need something similar to it.
>>>
>>> get '/login' => sub {
>>>    config->{layout} = undef;
>>>    template 'login', { path => param('requested_path') };
>>> };
>>>
>>> On Sat, Sep 12, 2015 at 9:01 PM, Kadir Beyazlı <kadirbeyazli at gmail.com>
>>> wrote:
>>>
>>> Hi All,
>>>
>>> I think I saw solution at mails but could not find at my search so I have to
>>> ask here.
>>>
>>> I set main layout.
>>> But I don't want main layout to be loaded at route /login.
>>> Is it possible disabling main layout at route /login although I am using
>>> template in it?
>>>
>>> get '/login' => sub {
>>>    template 'login', { path => param('requested_path') };
>>> };
>>>
>>> --
>>> Kadir Beyazlı
>>> GSM : +90 535 821 50 00
>>>
>>>
>>> --
>>> Kadir Beyazlı
>>> Computer Engineer
>>> GSM : +90 535 821 50 00
>>>
>>>
>>>
>>> --
>>> John J. McDermott, CPLP
>>> Learning and Performance Consultant
>>> jjm at jkintl.com 575/737-8556
>>> Check out my security blog posts
>>> Add an A for the Arts To STEM and get STEAM and a strong engine to move
>>> forward.
>>>
>>> _______________________________________________
>>> dancer-users mailing list
>>> dancer-users at dancer.pm
>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>>
>>
>>
>> --
>> Kadir Beyazlı
>> Computer Engineer
>> GSM : +90 535 821 50 00
>> _______________________________________________
>> dancer-users mailing list
>> dancer-users at dancer.pm
>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users



-- 
Kadir Beyazlı
Computer Engineer
GSM : +90 535 821 50 00


More information about the dancer-users mailing list