Fork me on GitHub


Setting Up Fusebox

Setting up Fusebox is as easy as telling Fusebox where to find your fusebox5 file and where to find your circuits. It also involves setting up a few parameters as well.

In the Installing Fusebox section, we went through 5 scenarios of where to place files. This section will expand on each of those scenarios working with the skeleton system to make sure that the application actually runs. Note: if you are going to try out all of these scenarios, make sure you give each scenario a different application name.

"Out of the box", the skeleton application is designed to work with a ColdFusion mapping (/fusebox5). This implies a shared Fusebox 5 core that many applications can use.

Setting Up: Scenario 1

Scenario 1 is a common occurrence within a shared hosting environment. You are given a webroot on the shared host and all files must be included there. To get your Fusebox application running simply make sure the line to include the fusebox5 file reads: Note that the leading / is removed so that the fusebox5 path is within the same directory structure that the index file is being called from.

Setting up: Scenario 2

Scenario 2 is for those of us who like a less flat directory structure. In this scenario, all of the Fusebox core and required directories are grouped in an "FBCore" directory with the circuit directories at the same level as the "FBCore" directory. Index.cfm and Application.cfm are under the webroot, while the three Fusebox files (fusebox.appinit, fusebox.init and fusebox.xml) are under the "FBCore" directory structure.

In this scenario and in all remaining ones, we add a new line to index.cfm: sets the path to the directory structure that holds all of the Fusebox related directories. It is not a path to the fusebox5 directory, but has to include all the directories that make up the Fusebox Application. In this case we need to set it to the FBCore directory relative to the index file. We then use the variable in the

Also beginning with this scenario, we have to make sure the application can find our circuits as well. Circuits are registered in the fusebox.xml file, which at this time is found in the "FBCore" subdirectory. The three circuit files, "controller, model and views") are set up relative to this particular file. Since they are one step up from the FBCore subdirectory, we modify the circuit registrations accordingly:

Setting up: Scenario 3

In scenario 3, we move the Fusebox Application out of the webroot while still keeping our ColdFusion Files in the webroot. Additionally, we keep the directory structure as flat as possible. Since our index file is below the Fusebox Application. The Fusebox_Application_Path variable is set accordingly.

Registering circuits in fusebox.xml is again relative to the fusebox.xml file.

Setting up: Scenario 4

Again in scenario 4, we have all the Fusebox Application files above the webroot, but in the "FBCore" directory structure. Our circuits are still flat within the webroot. We set up the index file accordingly (since the index file is below the webroot, we make sure it can find FBCore above it.

Registering the circuits in fusebox.xml again makes note of the fact that the fusebox.xml file sits one directory under the application root and that the circuit directories are still under the webroot.

Setting up: Scenario 5

My personal favorite and the one I use the most is this particular scenario. It keeps all my Application files above the webroot leaving only the index and Application files in the webroot, along with any files that the webserver would need such as images, css and javascript.

To make things easier, all circuits are setup in a subdirectory under the application root called "scripts", with all Fusebox Application directories in "FBCore". The index file does not change from Scenario 4, since the Fusebox Application hasn't been moved.

Registering the circuits in fusebox.xml must take into account that the circuits are in the application root and under a subdirectory.