Server Time:
Tuesday May 13 2008 05:26 AM  
Your Time:
  
HostMySite.Com is sponsoring this tutorial, please visit their site today!
This tutorial is sponsored by HostMySite.Com - ColdFusion Hosting

Fusebox 4.1 For Beginners Part 1
by: Craig
Email this tutorial to a friend Display Printer Friendly Format
[Download in PDF Format] [Download in FlashPaper Format]

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.


Date added: Mon. July 4, 2005
Posted by: Craig | Views: 14982 | Tested Platforms: CFMX,CFMX7 | Difficulty: Beginner
Categories Listed: Other Reusing Code XML

HostMySite.Com is sponsoring this tutorial, please visit their site today!
This tutorial is sponsored by HostMySite.Com - ColdFusion Hosting

This author's other tutorials:
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. - Date added: Wed. February 6, 2008
Actionscript Basics in CFFORM
This tutorial teaches some basic ways to achieve effects using actionscript with your flash forms. - Date added: Tue. February 27, 2007
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. - Date added: Sat. July 22, 2006
CFCs in Fusebox
This final part in the tutorials about fusebox 4.1 will explore the use of CFCs. - Date added: Tue. April 25, 2006
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. - Date added: Thu. October 27, 2005

Additional Tutorials:
· Fusebox 4.1 For Beginners Part 4

· Fusebox 4.1 For Beginners Part 3

· Fusebox 4.1 For Beginners Part 2
Please rate this tutorial:
5 Stars 4 Stars 3 Stars 2 Stars 1 Stars
Comments on this tutorial
Read previous comments on this particular tutorial
Need help?
If anyone needs help with this toturial I wrote please don't hesitate to email me dirrectly at kick12380@yahoo.com. I will repond to your questions quicker that way, because I don't always get a chance to be on easycfm but I always have my mail open. :-)
Posted by: Kicker
Posted on: 07/07/2005 02:35 PM
INDEX.CFM ... i'm confused.
PLEASE NEED HELP?

In the Fusebox4.1 Tutorial, I didn't understand what to put on Index.cfm .... and I'm a bit lost ... please could you help me? My address is marcelo_teteco@hotmail.com

Thanks you
Marcelo
Posted by: Marcelo Nogueira
Posted on: 08/04/2005 02:59 PM
Index.cfm
For everyone who found the explaination of the index.cfm file a little confusing. The index.cfm file is like the center of a spider's web. All the connections and actions start and end there. When your fusebox program/site is first swung into action by a visitor it goes out and connects to your welcome page. Once it is found it returns the results or display that it was told to get. When your user clicks on a link to another page in your site they in turn tell your index.cfm page to go get the page that deals with that "fuseaction". Your index.cfm is thus likened to a cfswitch statement. The differnce between a cfswitch statement and the index.cfm in fusebox is that the cfswitch statement is a flat spiders web or 2D where the index.cfm file is more like a ball of webbing or 3D thus allowing the index.cfm page to move up, down, left, right, back, forward, and every which way you can think of where as in a cfswitch statement you can only go down the statement till you find or don't find something that matches.
Posted by: Kicker
Posted on: 08/04/2005 03:40 PM
Where to go for more.
Anyone know of any online tutorials beyond this?
Posted by: Jay Tray
Posted on: 08/22/2005 12:16 PM
RE: Where to go for more
Jay I searched before writting this tutorial series and found nothing either than the documentation at fusebox.org. I plan on writing more on fusebox within the next few months. (with any luck.) But if you find some let me and everyone else know as well. Meanwhile if you have a question just email me and I will try to answer it for you.
Posted by: Craig
Posted on: 08/22/2005 03:28 PM
Pls help me.
HI!

I tried the first excersice but this is what i got:

<cfsilent>
<cfapplication
name="myFuseboxApp"
sessionmanagement="Yes"
sessiontimeout="#CreateTimeSpan(0,0,30,0)#"
clientmanagement="Yes">
</cfsilent>
<cfset FUSEBOX_APPLICATION_PATH = "">
<cfinclude template="fusebox4.runtime.cfmx.cfm">

---
Thanks.
Posted by: Garry Loh
Posted on: 03/22/2006 09:21 AM
RE: Pls help me
I am not sure how to answer this being you should get nothing with this first step in the tutorial. Just a blank page when viewed through the browser. What you show as code above is the index page as it should look when viewing it as code in an editor. If you could provide me with something more as to what you have done thus far it would help me help you.
Posted by: Craig
Posted on: 03/22/2006 12:11 PM
Post a new comment on this tutorial
post a new comment on this particular tutorial
Your Name:
Your Email:
Comment Title:
Comments:
Key Phrase:
 
Skyscrapper Banner Advertisement
ColdFusion Hosting by HostMySite

You are 1 of 579 active sessions! | Privacy | Company
Copyright © 2002 EasyCFM.Com, LLC. (Easy ColdFusion Tutorials) All Rights Reserved
All other trademarks and copyrights are the property of their respective holders.
ColdFusion Hosting ColdFusion Hosting
ADD TO:
Blink
Del.icio.us
Digg
Furl
Google
Simpy
Spurl
Y! MyWeb