Setting packages for views in config.xml?

Hey guys... just starting to play around with Coldbox over the last
week or so and I must say I LOVE it so far. After using Fusebox for
about 8 years the migration to Coldbox was pretty simple. Im still
trying to figure out a few of the intricate things but for the most
part, Im having a good time with it.

A question just popped in my head while working on this application
though. In the layouts section of the config.xml file, I have several
layouts defined and I have several "View" tags under each one to
define which layout I want to use by default for that view.

<Layout file="Layout.MainSidebar.cfm" name="Sidebar">

My question is this, since I put all of my views in folders (packages)
can I list the package in the View tag and have it inherit all of the
views or do you have to explicity list each view for the layout? Heres
an example of what Im thinking:

<Layout file="Layout.MainSidebar.cfm" name="Sidebar">

Obviously that doesnt work right now but Im wondering if there is some
way to do this.

Thanks in advance and keep up the great work!

Russ Johnson

Hi Russ,

That is a very interesting suggestion, and it might be a good idea to
enhance this to do this. However, as of now, if you want to implicitly
define view/layout declarations, this would be the way. However, I
suggest another method which would be cleaner. You need to set the
views to render in your handlers, so you can create a layout handler,
that basically sets a layout depending on the current set view. Then
you can fire this event via the postHandler convention. This means,
that after every event is executed, the postHandler gets executed
afterwards, this event will see what view is set and change the layout
if necessary using the setLayout method. Basically you are enhancing
the coldbox layout manager programmatically.

But I am really intriguide about your idea of declaring a package and
all its contents will inherit. So I am adding this as an idea ticket
for 2.1

Thanks Russ, Hope this idea helps. There are several ways to do it. I
have done this via a layout handler that get's executed in every
request or in postHandler methods.