Module Issues

I am still having a couple issues with modules and I am hoping someone can help me resolve them.

1.) Modules External Location - I have a stand along folder for this project (“c:\www\solitary”) that is not a part of any coldbox app. The documentation says that you can point to an external location and this is exactly what I need to do for development. However the following code does not seem to load my module (I added a mapping for this)

// Module Directives
modules = {
//Turn to false in production
autoReload = false,
// An array of modules names to load, empty means all of them
include = [],
// An array of modules names to NOT load, empty means none
exclude = []
};

modulesExternalLocation = ["/solitary"];

2.) layouts - in the config for the module there is an option for layoutParentLookup

“If true, coldbox checks for layouts in the parent overrides first, then in the module. If false, coldbox checks for layouts in the module first, then the parent.”

my module config

// If true, looks for views in the parent first, if not found, then in the module. Else vice-versa
this.viewParentLookup = true;
// If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa
this.layoutParentLookup = true;

This is exactly what I want. Ultimately the layouts for this module should be handled by the parent application. When the module is first installed though I want some default layout to show the user the different views. In my module config I have

layoutSettings = {
defaultLayout = “layout.security.cfm”
};

So far everything is working great. Now I want the layout to be defined in the parent so I added a file to {project_root}/layouts/layout.security.cfm. When I reload the application the layout is still coming from the module. What am I doing wrong here. Can anyone verify that this works as it should?

Dan,

The modulesExternalLocation should point to a folder that contains modules to register and not a module itself. It will then find and register all modules in that location.

The layoutParentLookup will lookup in the parent, but it would expect the layout to be in a package of the same name as the module, so in the parent it would expect it to be in

{project_root}/layouts/solitary/layout.security.cfm

Same for the viewParentLookup.

Hope that helps.

Curt

I moved the layout into

{project_root}/layouts/solitary/layout.security.cfm and it still doesn’t use that one. It is still using the layout from the module.

modulesExternalLocation I don’t think is an array, but a single string only.

Regards,

Andrew Scott

http://www.andyscott.id.au/

No, it is for sure an array.

Curt

I was under the impression it was a list and not an array, the code for ColdBox indicates a simplevalue and then does a listToArray() to set it up.

Regards,

Andrew Scott

http://www.andyscott.id.au/

Correct, if the user supplies a simple value instead of the expected array, we convert it for them, so really either will work, but it was designed to be an array.

Curt

Hmm,

Interesting. I will have to setup a little test, but I was pretty sure that would work. I will let you know what I find out.

Curt

I didn’t think the layout used folders, what happens if you move the layout from solitary to the root of layouts?

Regards,

Andrew Scott

http://www.andyscott.id.au/

doesn’t work in either locations… I don’t have to configure anything in the main coldbox app do it?

Thank You
Dan Vega
danvega@gmail.com
http://www.danvega.org/

I don’t think so, unless you changed the locations using the conventions.

Regards,

Andrew Scott

http://www.andyscott.id.au/

Dan,

As Luis stated, I missed the modules folder in my example.

So

{project_root}/layouts/modules/solitary/layout.security.cfm

Hope that helps. Sorry for the confusion.

Curt

That worked, thanks Curt! So I am just wondering, If I am going to create modules that I want to distribute what is my best development mode…

create a folder under root and have a folder for each project

/coldbox-modules/
+solitary

and then point to it from a test project using externalModulesLocation?

I would have them be available to be installed directly into the end users modules folder the same way Luis has made the forgeBox module available, but what you describe seems like a good option for being able to show off multiple modules you have built.

Curt

It doesn’t seem to work for me either way…

modulesExternalLocation = [“c:\www\coldbox-modules”];

I have a folder

  • coldbox-modules
    +solitary
  • module folders/files here

and its never registering this module

// coldbox directives
coldbox = {
//Application Setup
appName = “Coldbox Catalog”,

//Development Settings
debugMode = true,
debugPassword = “”,
reinitPassword = “”,
handlersIndexAutoReload = true,
configAutoReload = false,

//Implicit Events
defaultEvent = “dashboard.index”,
requestStartHandler = “main.onRequestStart”,
requestEndHandler = “”,
applicationStartHandler = “”,
applicationEndHandler = “”,
sessionStartHandler = “main.onSessionStart”,
sessionEndHandler = “”,
missingTemplateHandler = “”,

//Error/Exception Handling
exceptionHandler = “”,
onInvalidEvent = “”,
customErrorTemplate = “”,

//Application Aspects
handlerCaching = false,
eventCaching = false,

modulesExternalLocation = [“c:\www\coldbox-modules”]
};

Dan,

My modulesExternalLocation uses a mapped path and it works fine.

modulesExternalLocation = ["/x/xx/xxx/coldbox/modules"],

HTH
-Adam

Hmm, turn debug mode for the module service:

debug = [“coldbox.system.web.services.ModuleService”]

And see what it reports

Luis F. Majano
President
Ortus Solutions, Corp

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

modulesExternalLocation is a relative path and not an absolute path.

Regards,

Andrew Scott

http://www.andyscott.id.au/

this works

modulesExternalLocation = ["/coldbox-modules"]

from the docs, when I was skimming through I saw absolute and jumped through…RTFM Dan :wink:

“You can also tell ColdBox to not only look in the conventions folder for your modules but anywhere in the server you like with the ColdBox directive: ModulesExternalLocation. This setting is an array of locations you want to tell ColdBox to look for modules. Each array element is the instantiation location which can use ColdFusion mappings or an absolute reference from the root of your application. Internally each of those entries will be expanded for you, so please be aware of this.”

So it looks like if its outside of your application the only way is to use a mapping