2

tl;dr: renderLayout(layout="myLayout", view="alpha/bravo/viewFile") resolves alpha as a module name rather than a package name in the host application, even if code execution is in the package rather than the module.

How do I get the path resolution to be consistent when either running the handler directly or when calling it via runEvent from a module?


I posted this on the CB google group, but then thought it may be best to ask here.

Working example here: https://github.com/jinglesthula/cbModuleExample

If you run install (I .gitignored the coldbox folder), then cd into the /app folder and server start --rewritesEnable you can visit http://127.0.0.1:<whatever port>/example/admin/test/ajax to see it in action.


From the example:

/app/modules_app/example/handlers/admin/test.cfc -> ajax() calls runEvent("admin.test.ajax")

/app/handlers/admin/test.cfc -> ajax() calls `renderLayout( layout = "layout.div", view = "admin/test/ajax" )

"admin/test/ajax" normally resolves to /app/views/admin/test/ajax.cfm, but in this case it's resolving to /app/modules_app/admin/views/test/ajax.cfm.

You can comment out line 18 and uncomment line 19 in /modules_app/example/admin/handlers/test.cfc to see a workaround.

You can also go to /admin/test/ajaxDirect in your browser to see that the renderLayout() call in the non-working example is correct.

Note: I have this.viewParentLookup = true in my ModuleConfig.cfc. I've tried reloading the module with it set to false and I get the same result.

jinglesthula
  • 4,446
  • 4
  • 45
  • 79
  • Hi, this is all a lot to follow. Can you throw together a simple example app that demonstrates the issue and commit it to a GitHub rep?. Then, anyone can clone it, start up a server in CommandBox, and see just what you're doing. – Brad Wood Apr 25 '17 at 17:03
  • 1
    Sorry - it is quite a bit. I edited the question and included a link to the github repo at the top of it. The code there is slightly simplified from the question (I put the module in `modules_app` rather than trying for a completely separate location), but demonstrates the issue in action. – jinglesthula Apr 25 '17 at 18:27
  • @BradWood I boiled it down to just the question, link/instructions for the example repo, and the pertinent info. – jinglesthula Apr 27 '17 at 19:29
  • Thanks, I'm super busy at our Into The Box conference this week so I won't be able to take a look for a couple more days. – Brad Wood Apr 27 '17 at 22:33
  • 1
    @BradWood no worries - and good luck w/ the conference. Wish I could be there – jinglesthula Apr 28 '17 at 14:35

0 Answers0