[1.2.0] Module using Theme Layouts

Hi all,

I’m building a module for ContentBox which deals with product listings.I understand how to use layouts local to the module, but how do I take advantage of the layouts included in the active theme? Keeping the module pages consistent with the rest of the site.

So for example, the entry point to my modules pages is:

http://example.com/products

Which loads the event:

Products:General.index

with its corresponding view and layout from:

/contentbox/modules/Products/views/General/index.cfm

/contentbox/modules/Products/layouts/main.cfm

So how can I set it to use:

View - /contentbox/modules/Products/views/General/index.cfm

Layout - /contentbox/layouts/themeName/layouts/pages.cfm

In my handler:

event.setLayout("WHAT WOULD GO HERE"); event.setView("General/index");

Hope that makes sense.

Thanks,

Richard

var currentLayout = settingService.getSetting( “cb_site_layout” );

var thisLayout = “page, blog or whatever”;

event.setLayout(name="#currentLayout#/layouts/#thisLayout#", module=“contentbox”);

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Ah I see, cleaver stuff.

So doing that gave me another similar problem. The theme layouts use the cb helper and all the other cb variables in the prc collection so I get errors because none of them exist when using the layout in the module. It seems that all these are added by the CBRequest interceptor. So how do I then make use of the contentbox-ui CBRequest interceptor.

Would I need to add an interceptor to my ModuleConfig.cfc

interceptors = [ {class="modules.contentbox-ui.interceptors.CBRequest", properties={ entryPoint=this.entryPoint }, name="CBRequest@cbUI" } ];

Thanks,

Richard

Hmm, yes, got it.

Maybe we can rethink on how to make it easier as this is the first use case I see of this.

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

OK, sounds good.

Thanks