[Coldbox 4.1.0] Views location for modules

31 views
Skip to first unread message

Nick

unread,
Oct 11, 2016, 9:40:12 PM10/11/16
to ColdBox Platform
We have a handler that inherits from a module's handler. Is there any way to set it up so that the handler will find the view automatically in the module's folder?

Here's handler.cfc:
component extends="testModule.handlers.testModuleHandler" {
public void function index(any event) {
        
}
}

The view is located in /modules/testModule/views/testModuleHandler/index.cfm.

At the moment we need to add this line to the "index" function to make it work:
event.setView(view="testModuleHandler/index", module="testModule");

How can we avoid having to add that line, and have CB automatically find the view in the module folder the same way it's doing it for "external views".

Thanks for any help.

Luis Majano

unread,
Oct 12, 2016, 9:34:22 AM10/12/16
to ColdBox Platform
Where is this handler? In the same module?

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057




--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/3464fb59-68d9-4451-8557-2c47ca272818%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nick

unread,
Oct 12, 2016, 4:39:33 PM10/12/16
to ColdBox Platform
The handler.cfc is outside of the module (part of the host application), but it's inheriting a handler from the module.

Luis Majano

unread,
Oct 12, 2016, 8:27:10 PM10/12/16
to ColdBox Platform
Any reason why you are using inheritance from a module? What is the taxonomy?


Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057

On Wed, Oct 12, 2016 at 3:39 PM -0500, "Nick" <ni...@devx.co.nz> wrote:

The handler.cfc is outside of the module (part of the host application), but it's inheriting a handler from the module.

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.

Nick

unread,
Oct 12, 2016, 10:26:28 PM10/12/16
to ColdBox Platform
We're doing this for two reasons:

1. Inheritance allows for more liberty for customization. Should we try to use settings instead for customization?
2. We don't really like the url format to access a module action, so instead of "http://testsite.com/?event=mod:dashboard", we prefer "http://testsite.com/?event=dashboard".

br...@bradwood.com

unread,
Oct 13, 2016, 10:37:45 AM10/13/16
to col...@googlegroups.com
Just a note on the URL-- if you use SES urls, you can have full control over what the routes are.  
 
To answer your original question-- no, the handler's super class has no bearing on where views are looked for.  You could probably make the "module" parameter a variable that's paramed in your super's "preHandler" or something.  

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 
 
 
--------- Original Message ---------
--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.

Daniel

unread,
Oct 15, 2016, 6:22:53 AM10/15/16
to ColdBox Platform
I had the same problem by creating a new module with commendbox 3.3. The new custom module went into the folder  "/modules_app" which is fine regarding the blog post

 - which makes sense to me. Even if it covers content box

But than I got the same error as Nick.

Not sure if this if "/modules_app" is the "new default" place for custom modules in any CB app. To avoid the error I had to move it to the "/modules" folder 

Daniel

Luis Majano

unread,
Oct 15, 2016, 7:04:42 AM10/15/16
to ColdBox Platform
The new modules_app convention is a 4.3 feature


Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.

Nick

unread,
Oct 16, 2016, 10:33:23 PM10/16/16
to ColdBox Platform
Thanks Brad. We'll look into the preHandler suggestion.
Reply all
Reply to author
Forward
0 new messages