ColdBox Module // Layouts

I haven’t do much research into this so I thought I would just ask first.

I know its possible to define a layout or multiple layouts inside a module but is it possible to make the layouts inside of a specific modules override the coldbox wide default layout without having to change the config/Coldbox.cfc?

Yes, by default this is the default behavior. Have a look at the ModuleConfig.cfc for more information.

I’m sorry but I can’t seem to get it to work.

I have a layout inside my module but I can’t get it to override the parent’s default layout.

I know the default behavior is to let the parents layout to override the module’s layout however I need to reverse it so the module overrides the parent.

What would the ModuleConfig.cfc setting be?

Actually it is the other way around, the module overrides the parent by default.

Look for### Public Module Properties/DirectivesNow if that is not working for you, then you may just have code that is doing this, which means you may need to change that. If any of your interceptors or handlers are changing the layout or views, which can be the case, then you may need to look at changing the way you are attempting to change the layout and views.


Let me try to phrase this differently.

I have my parent app which has a layouts folder. Inside the folder it has Layout.Default.cfm

And I have a module called Theme that has a layouts folder as well and inside it, it has Layout.Theme.cfm.

When I type in siteurl.tld/theme it displays the correct layout which is Layout.Theme.cfm. However if I visit siteurl.tld/ it displays the Layout.Default.cfm.

What I am trying to figure out is how to override the Layout.Default.cfm for the parent app and all other modules? Does that make sense? I’ve read the docs you suggested again - several more times in fact but I can’t seem to get it to work the way I want. Is this even possible?

Ok, no I am with you.

The only way that I can see that happening, is if you write an interceptor to change the default layout when the module is loaded.

Cool - anyone else have any ideas how a module can override the parent apps’ settings? I’ve tried using an interceptor with no luck or at least the way I am trying to implement this.

To me - Modules should have a structure in the ModuleConfig.cfc that will allow me to override any parent app’s Coldbox.cfc setting.

And to be clear - I am not talking about the custom settings. I am talking about Datasources, Layouts, etc… that exists in the parent app. I know how to change them for the specific module.

My goal being to create a module that its only purpose is creating the theme of the site. That way I can drop in modules for a new project and have my theme/layouts/default views ready to go with very little configuration.

Yep it’s called parent settings. Right there in the docs


You’re saying this should work?

function configure(){

parentSettings = {
layoutSettings = {
defaultLayout = “Layout.Bootstrap.Default.cfm”


Be careful as you are overriding. But yes.

Unfortunately it didn’t work. :frowning: I must be missing something - i’m sure its on my end.

Ok so I dug into the CB code and discovered its not LayoutSettings structure but rather just defaultLayout :slight_smile:

I was trying to mimic the structure of ColdBox.cfc & ModuleSettings.cfc however it appears to be just a root level structure and that fixed the problem. Perhaps that could be updated in the docs to make it a little clearer for people. Unless it is and i’m just an idiot and missed it.

Thanks for pointing me in the right direction.

Lol. Thanks

Well I did it once with an interceptor, by just changing the conventions on the fly. Just out of couriosity what did you try? The layout can be defined in the module to be loaded, or you can change it via code by setting the layout on the preProcess().


This is what ended up working for me…

function configure(){

parentSettings = {
defaultLayout = “…/modules/Themes/layouts/Layout.Bootstrap.Default.cfm”

where …/ would go up a directory because the default directory appears to be //layouts/ so it in turns becomes //layouts/…/modules/Themes/layouts/Layout.Bootstrap.Default.cfm

Apparently you can override a bunch of settings just as long as you know the specific Struct/Key.

Yeah, I saw the response and didn’t post back after reading it. Struggling with a very bad back at the moment, so wasn’t really concentrating…

But that is handy to know, because I wasn’t even aware about that.

All settings can be overridden. Just dump the config settings

Luis Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
Social: | |

yes - i was a little slow on figuring that out :stuck_out_tongue: LOL