[Dancer-users] set layout for a single prefix

Brian E. Lozier brian at massassi.com
Thu May 26 16:21:18 CEST 2011


I usually don't use the dancer layout mechanism.  I use the
template::toolkit WRAPPER stuff because it lets me define variables in
templates and the wrapper template can see them.  This allows me to
set title tags in the content template and they get picked up by the
outer template.

I've started messing with Dancer::Plugin::SimpleCRUD and it's applying
layouts manually (there's no real way for me to tell not to do that)
and it doesn't use the template() function so I can't hook into it.
I'm looking into working around that at least until I can make a patch
or BIGPRESH can change that.

In the meantime, I'm wondering if there's a way for me to set the
layout for a single dancer module under "prefix."  For example, I'll
use my normal, non-layout modules:

MyApp::Root (prefix undef)
MyApp::Forums (prefix /forums)
MyApp::Articles (prefix /articles)

But then for some other module:

MyApp::Admin (prefix /admin)

I will use a layout.  Is this possible?  When I "set layout" in
MyApp::Admin it uses the layout for the non-admin routes as well.

Thanks,
Brian


More information about the Dancer-users mailing list