Fusebox 4.1 For Beginners Part 1
Untitled Document

Fusebox 4.1 For Beginners Part 1

What is Fusebox? Circuit.xml.cfm and Fusebox.xml

Fusebox is a powerful and easy way to create dynamic sites and large programs for the web. It allows multiple users to work on the same project at once without worrying about each others code (as long as the basics are known such as db name and where images are stored, etc). It is also a great way for single coders to create powerful and compelling web sites and programs with ease. What makes fusebox coding so great is its simplicities of coding. You can create just small little files and maintain them easily and effectively. Also with fusebox if one part of your program or site is broke or not working it doesn't affect the rest of your site or program.

We all know what a fusebox is. If you own a computer you are using a fuse box right now. It's usually located in a basement or closet and it allows you to cut the power to any given room or rooms you would like. If you accidentally drop your hairdryer into the tub a fusebox will have a fuse blow protecting you from sudden death (hopefully). It is the same idea behind fusebox 4.1.

To follow this tutorial please go to http://www.fusebox.org and download your copy of fusebox 4.1 and unzip it to your wwwroot folder. Once you have that done we can begin.

Open up your favorite code editor (I am using dreamweaver but any will do.) and create a file called circuit.xml.cfm. Save it to the same folder as your index.cfm file is in.

Now this file is sort of like the brain of the fusebox. It will house the information that each circuit will do. But before we get into that lets put some code in here. Place the following code into the circuit.xml.cfm page.

<circuit access="public">
</circuit>

Circuit.xml.cfm

<circuit access="public">
</circuit>

If you're rubbing your temples and scratching your head at this don't worry you are not going crazy. This is XML in a CFML document without the use of cfsavecontent tag. If you are wondering what cfsavecontent is don't worry about it now you won't need it for this tutorial series.

Ok now that we have the basic for circuit.xml.cfm laid out lets open the fusebox.xml document you have unzipped. Now take a minute to study this document. It is an XML document. The first tag opens the fusebox. The next tag you see is the <circuits> tag. Notice that it also has a closing tag and that there is nothing in between. Now go down the page a little bit and you will see some more tags that are called "parameter" You will see 14 of them. Now if you are reading through them your head is probably starting to hurt. I know mine did at first.

Don't worry what they all mean just yet. Let's just focus on the one with the name of "defaultFuseaction". Notice that the value is "main.welcome". Ok now if you have a testing server running cfmx 6 or above open up index.cfm that was included in the fusebox 4.1 download and open it in your browser. You should see a error message that says something along the lines of, " You specified a Circuit of main which is not defined." So what happened? The index page is the main controller of everything in your fusebox. It is the box that makes up your fusebox. Every single item has to pass through the index.cfm page. So why isn't it working? It is not working because we have no circuit called main. Let me take a moment to explain something here before we fix our broken circuit.

Your circuits can be named anything you would like them to be as long as it is not something reserved by coldfusion. In this case our circuit is named main. It was defined in the fusebox.xml document set in the parameter named "defualtFuseaction". It looked like this main.welcome. So what happened to the welcome? The welcome is the fuse action. It is what the circuit main does. So it would read something like this to a server. The user would like to view the circuit main and the action this circuit is to perform for the user is welcome.

Ok now that we have explained this lets fix the broken circuit. First step we must take is to create the circuit main. Go back to your fusebox.xml document and go back up to the circuits tag. Now type in between the opening and closing circuit tags the following:

<circuit alias="Main" path="" parent="" />

Fusebox.xml

<fusebox>
<circuits>
    <circuit alias="Main" path="" parent="" />
</circuits>

 

What we just did was created a circuit called main. NOTE: Remember that everything in XML must have a closing tag.

Once you have done that open circuit.xml.cfm and place this following code in it making sure you place it in between the circuit tags:

<fuseaction name="Welcome"></fuseaction>

Circuit.xml.cfm
<circuit access="public">
    <fuseaction name="Welcome"> </fuseaction>
</circuit>

Now you have created the circuit and the action it is to do!

Once this is completed move on to the second part of the tutorial.



All ColdFusion Tutorials By Author: Craig
  • Actionscript Basics in CFFORM
    This tutorial teaches some basic ways to achieve effects using actionscript with your flash forms.
    Author: Craig
    Views: 10,385
    Posted Date: Tuesday, February 27, 2007
  • CFCs in Fusebox
    This final part in the tutorials about fusebox 4.1 will explore the use of CFCs.
    Author: Craig
    Views: 7,148
    Posted Date: Tuesday, April 25, 2006
  • Creating a chat system with Flex and Coldfusion
    This tutorial will cover both the Flex and Coldfusion areas of a chat application that uses the users computer to store the entire chat log and coldfusion only stores the 5 newest messages.
    Author: Craig
    Views: 3,408
    Posted Date: Wednesday, February 6, 2008
  • Fusebox 4.1 For Beginners Part 1
    This four part series will introduce cf beginners to the fusebox frame work and help them get a grasp of this powerful technology.
    Author: Craig
    Views: 16,177
    Posted Date: Monday, July 4, 2005
  • Fusebox 4.1 For Beginners Part 2
    This four part series will introduce cf beginners to the fusebox frame work and help them get a grasp of this powerful technology.
    Author: Craig
    Views: 19,186
    Posted Date: Monday, July 4, 2005
  • Fusebox 4.1 For Beginners Part 3
    This four part series will introduce cf beginners to the fusebox frame work and help them get a grasp of this powerful technology.
    Author: Craig
    Views: 12,279
    Posted Date: Monday, July 4, 2005
  • Fusebox 4.1 For Beginners Part 4
    This four part series will introduce cf beginners to the fusebox frame work and help them get a grasp of this powerful technology.
    Author: Craig
    Views: 11,904
    Posted Date: Monday, July 4, 2005
  • Turning up the heat in Fusebox 4.1
    This tutorial teaches you some methodology and new xml tags you can use to create complex, but easy to use application in the fusebox framework.
    Author: Craig
    Views: 6,922
    Posted Date: Thursday, October 27, 2005
  • Using Flash Remoting to take your CFForms Farther
    This tutorial shows you how to make a remote connection to a cfc using actionscript for your cfforms.
    Author: Craig
    Views: 9,023
    Posted Date: Saturday, July 22, 2006