now musing at www.aliaspooryorik.com!

February 15, 2008

Specifing a directory for implicitly locating circuits in Fusebox 5.5 using FUSEBOX_CALLER_PATH

Filed under: ColdFusion, Fusebox — aliaspooryorik @ 4:50 pm

An updated version of this article has been posted here:

http://www.aliaspooryorik.com/blog/

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.

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. 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).

2 Comments »

  1. FUSEBOX_CALLER_PATH is not intended for this usage (it is intended only to allow other applications to “include” Fusebox applications).

    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 @ 3:49 am | Reply

  2. Hi Sean,
    Thanks for the comment, I have updated this article on my new blog.

    Comment by aliaspooryorik — March 28, 2008 @ 10:03 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.