[Dancer-users] Layouts
minimalist
minimalist at lavabit.com
Sat Feb 26 03:52:34 CET 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110225/2550a535/attachment-0001.htm>
More information about the Dancer-users
mailing list