I like to build my apps so that all the Controller, Model and View circuits and inside a directory off the webroot. It just seems neater to me not having lots of folders in the webroot application root.
If you are using the noxml version of Fusebox 5.5, then your model view and controller circuits need to have a directory structure which complies with the Fusebox conventions. To quote from the docs:
Fusebox attempts to find a CFC that represents the circuit by looking for:
- controller/alias.cfc [access=”public”]
- model/alias.cfc [access=”internal”]
- view/alias.cfc [access=”internal”]
This means that you have to have the Controller, Model and View directories in the webroot application root. If like me, you like to have them in a subfolder, then you can edit the FUSEBOX_CALLER_PATH parameter to specify a directory, e.g:
FUSEBOX_CALLER_PATH = getDirectoryFromPath(getCurrentTemplatePath()) & "\my_fusebox_scripts\";
This means you can have a nice neat directory structure and have the time saving advantages of not having to declare each circuit in the fusebox.xml.cfm file (and of course reloading fusebox each time you add a circuit).
So, my directory structure for this blog would be (from the root of the web site www.aliaspooryorik.com):
- Fusebox5/ (shared my multiple web apps on this domain)
- blog/
- blog/Application.cfc (extends Fusebox5.Application)
- blog/index.cfm (where fusebox_caller_path is set)
- blog/my_fusebox_scripts/
- blog/my_fusebox_scripts/controller/
- blog/my_fusebox_scripts/model/
- blog/my_fusebox_scripts/view/
It is also worth mentioning that the parsed directory location will be the same as the value set in FUSEBOX_CALLER_PATH. So for this blog it is bloc/mvc/parsed/
This post was updated: 28 March 2008, to change webroot to application root (which is what I meant originally - sorry, my mistake!)





Fusebox does *not* require controller/model/view directories to be in the webroot. It requires them to be in the *application* root which is generally where your index.cfm is. If your index.cfm is in a different place to the body of your application, you can use FUSEBOX_APPLICATION_PATH to specify the relative path from index.cfm to the circuits.
However, using CFCs-as-controllers means that Fusebox still has to be able to deduce where they live in order to create them. Your options are: the CFCs have to be somewhere under your webroot (Fusebox tests the webroot path against the application path and strips the common stem then tries to create the CFCs based on what's left) or you need a mapping that is part of the directory path to the application root (Fusebox starts at the application root directory and treats it as a mapping, walking back up the tree looking at compound mappings).
Comment by Sean Corfield – March 28, 2008
I did mean the application root and not the webroot, and I've updated the article. Sorry, my mistake, I should have spotted that.
Thanks for pointing it out!
Comment by John Whish – March 28, 2008
Comment by Jesse – June 25, 2009