Hi guys, The template layout is bound to the current application. This makes it useful only if you change applications. In the following example switching layouts will work: # ==== File A.pm ==== package A; use Dancer ':syntax'; layout 'main'; get '/' => sub { template 'index' }; load_app 'A::B'; true; # ==== File A/B.pm ==== package A::B; use Dancer ':syntax'; layout 'users'; get '/users' => sub { template 'users_index' }; true; The following is an example where switching layouts will NOT work: # ==== File C.pm ==== package C; use Dancer ':syntax'; layout 'main'; get '/' => sub { template 'index' }; layout 'users'; get '/users' => sub { template 'users_index' }; true; In the above situation the layout won't get changed. I think the layout setting should be bound to each route. When a new route registers it should know what layout was selected last. I think it will make more sense this way. Regards, Nick aka minimalist
"minimalist" <minimalist@lavabit.com> wrote:
In the above situation the layout won't get changed. I think the layout setting should be bound to each route. When a new route registers it should know what layout was selected last. I think it will make more sense this way.
I think you need to be calling the layout keyword within the route it should apply to, or better, use the layout option when calling template as in: template 'foo', { foo => 'bar' }, { layout => 'layoutname' }; That would work. -- David Precious <davidp@preshweb.co.uk> Sent from my phone so please excuse brevity / poor quoting style etc
participants (2)
-
David Precious -
minimalist