Listing 1: Fuse Stub

<!---
<fusedoc fuse="qryGetBreed.cfm" language="ColdFusion" specification="2.0">
  <responsibilities>
    I return a recordset of data for the specified breed.
  </responsibilities>
  <properties>
    <history author="jeff@grokfusebox.com" role="Architect" date="2005-10-11" type="Create"
	 />
  </properties>
  <io>
    <in>
      <number name="breedID" precision="Integer" scope="attributes" optional="No" />
    </in>
    <out>
      <recordset name="qryGetBreed">
        <number name="categoryID" precision="integer" optional="No" />
        <number name="breedID" precision="Integer" />
        <string name="breedName" />
        <string name="breedDescription" />
      </recordset>
    </out>
  </io>
</fusedoc>
--->

<cf_querysim>
qryGetBreed
categoryID,breedID,breedName,breedDescription
1|101|Finch|The little finch provides lots of entertainment, and has a soft cheerful voice and
 unique personality. A pleasure to care for, its soft chirping is soothing and pleasant. They
  are happy in quiet surroundings.
</cfquerysim>

Listing 2: Test Harness

<!-- tst_actGetCategoryTitle.cfm -->
<!--- -->
<fusedoc fuse="tst_actGetCategoryTitle.cfm" language="ColdFusion" specification="2.0">
<responsibilities>
  I am a unit test harness for the actGetCategoryTitle.cfm fuse.
</responsibilities>
<properties>
  <history date="16/Oct/2005" author="Your Name Here" email="yourname@yourdomain.com" type="create"/>
</properties>
</fusedoc>
 --->

<!--- ********************************************************* --->
<!--- The following lines are copied from the .ini file         --->
<!---   [Settings] in C:\CFusionMX7\CustomTags\harness2.ini  --->
<!--- ********************************************************* --->

<cfinclude template="../fusebox.init.cfm">

<!--- The following lines set up the fusebox API environment.   --->
<cfscript>
fusebox=StructNew();
fusebox.IsCustomTag = False;
fusebox.IsHomeCircuit = True;
fusebox.IsTargetCircuit = True;
fusebox.Circuit = "foo";
fusebox.Fuseaction = "";
fusebox.HomeCircuit = "";
fusebox.TargetCircuit = "";
fusebox.ThisCircuit = "";
fusebox.ThisLayoutPath = "";
fusebox.CurrentPath = "";
fusebox.RootPath = "";
</cfscript>

<!--- ********************************************************* --->
<!--- The following lines are generated from the fusedoc.       --->
<!--- ********************************************************* --->

<cfset attributes.categoryID=1>

<!--- ********************************************************* --->
<!--- Now include the fuse to be tested.                        --->
<!--- ********************************************************* --->
<cfinclude template="actGetCategoryTitle.cfm">


<!--- ********************************************************* --->
<!--- The following lines are copied from the .ini file         --->
<!---   [ShowResults] in C:\CFusionMX7\CustomTags\harness2.ini  --->
<!--- ********************************************************* --->

<!--- The following lines are included after the fuse to be tested.  --->
<cfdump var="#variables.categoryTitle#">

Listing 3: fusebox.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Auto-generated by FuseminderFB4 for Jeff Peters (jeff@grokfusebox.com) 15-Oct-05 06:15
 PM -->

<fusebox>

  <circuits>

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

    <circuit alias="Navigation" path="Navigation/" parent="PetmarketFB" />

    <circuit alias="Search" path="Search/" parent="PetmarketFB" />

    <circuit alias="Catalog" path="Catalog/" parent="PetmarketFB" />

    <circuit alias="Users" path="Users/" parent="PetmarketFB" />

    <circuit alias="Information" path="Information/" parent="PetmarketFB" />

    <circuit alias="Cart" path="Cart/" parent="PetmarketFB" />

  </circuits>


 <parameters>
    <parameter name="fuseactionVariable" value="fuseaction" />
    <parameter name="defaultFuseaction" value="home.main" />
    <parameter name="precedenceFormOrUrl" value="form" />
    <parameter name="mode" value="development" />
    <parameter name="password" value="" />
    <parameter name="parseWithComments" value="true" />
    <parameter name="scriptlanguage" value="cfmx" />
    <parameter name="scriptFileDelimiter" value="cfm"/>
    <parameter name="maskedFileDelimiters" value="htm,cfm,cfml,php,php4,asp,aspx" />
    <parameter name="characterEncoding" value="utf-8" />
  </parameters>

  <globalfuseactions>
    <preprocess>
 </preprocess>
    <postprocess>
 </postprocess>
  </globalfuseactions>
  
  <plugins>
    <phase name="preProcess">
    </phase>
    <phase name="preFuseaction">
    </phase>
    <phase name="postFuseaction">
    </phase>
    <phase name="fuseactionException">
    </phase>
    <phase name="postProcess">
    </phase>
    <phase name="processError">
    </phase>
  </plugins>
</fusebox>

Listing 4: circuit.xml

<!-- Auto-generated by FuseminderFB4 for Jeff Peters (jeff@grokfusebox.com) 15-Oct-05 06:15
 PM -->
<circuit access="public">
  <prefuseaction>
  </prefuseaction>


  <fuseaction name="showBreed">

    <include template="qryGetBreed" />

    <include template="qryBreedItems" />

    <include template="actGetCategoryTitle" />

    <xfa name="addToCartButton" value= "cart.addItemsToCart" />

    <include template="dspBreed" />

  </fuseaction>


  <fuseaction name="showCategoryBreeds">

    <include template="qryBreedNames" />

    <xfa name="breedLink" value= "catalog.showBreed" />

    <include template="dspCategoryBreeds" />

  </fuseaction>

 
  <postfuseaction>
  </postfuseaction>
</circuit>

Listing 5: Layout Fuse

<!---
<fusedoc fuse="dspSiteLayout.cfm" language="ColdFusion" specification="2.0">
  <responsibilities>
    I display the final site layout.
  </responsibilities>
  <properties>
    <history author="jeff@grokfusebox.com" role="Architect" date="2005-10-11" type="Create"
	 />
  </properties>
  <io>
    <in>
      <string name="mainContent" scope="variables" optional="No" />
      <string name="imageBarContent" scope="variables" optional="No" />
      <string name="drillBoxContent" scope="variables" optional="No" />
      <string name="menuContent" scope="variables" optional="No" />
      <string name="searchBarContent" scope="variables" optional="No" />
      <string name="adContent" scope="variables" optional="No" />
    </in>
    <out>
    </out>
  </io>
</fusedoc>
--->

<cfparam name="mainContent" default="">
<cfparam name="imageBarContent" default="">
<cfparam name="drillBoxContent" default="">
<cfparam name="menuContent" default="">
<cfparam name="searchBarContent" default="">
<cfparam name="adContent" default="">

<cfoutput>
<html>
<head>
  <title>Pet Market</title>
  <style>
    b{font-family:arial,geneva,helvetica,sans-serif;}
    a:hover{color:009900;text-decoration:underline;}
    a.button:hover{color:00ff00;}
    .button:visited{color:00aa00;}
    td {font-family:arial,geneva,helvetica,sans-serif;}
    .text{font-family:arial,geneva,helvetica,sans-serif;font-size:75%; line-height:135%;}
    .label{font-family:arial,geneva,helvetica,sans-serif;font-size:70%;}
    .labelstrong{font-size:70%;color:##000000;font-weight:bold;}
    .headline{font-family:arial,geneva,helvetica,sans-serif;font-size:125%;font-weight:bold;}
  </style>
</head>
<body  background="images/dog_bg_1800.jpg" leftmargin="0" topmargin="0"
 style="background-repeat: no-repeat;" link="336633" vlink="336633" bgcolor="white">
  #menuContent#
  <table border="0" cellpadding="0" cellspacing="0" width="800">
    <tr valign="top">
      <td width="175" nowrap align="right">
        <img src="images/clear.gif" alt="" width="1" height="1" hspace="85" vspace="85"
		 border="0" alt=" "><br clear="all">
        #drillBoxContent#
      </td>
      <td>
        <img src="images/clear.gif" alt="" width="1" height="1" vspace="25" border="0" alt="
		 "><br clear="all">
        <table border="0" cellpadding="0" cellspacing="0" bgcolor="black" width="400">
          <tr>
            <td>
              <table border="0" cellpadding="0" cellspacing="1" bgcolor="black"
			   width="100%">
                <tr>
                  <td>
                    #imageBarContent#
                  </td>
                </tr>
                <tr valign="top">
                  <td>
                    #mainContent#
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
      <td width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="65"></td>
          </tr>
        </table>
        #searchBarContent#
        #adContent#
      </td>
    </tr>
  </table>
  <br><br>
</body>
</html>

</cfoutput>

Listing 6: Checkout Layout Fuse

<!---
<fusedoc fuse="dspCheckoutLayout.cfm" language="ColdFusion" specification="2.0">
  <responsibilities>
    I display the component variables that make up the shopping checkout.
	If the content of a particular band is empty, I put a link to the band's
	XFA around the band's title.  Otherwise, the band's title doesn't have a link.
  </responsibilities>
  <properties>
    <history author="jeff@grokfusebox.com" role="Architect" date="2005-10-11" type="Create"
	 />
  </properties>
  <io>
    <in>
      <string name="xfa.loginLink" optional="No" />
      <string name="xfa.customerDetailsLink" optional="No" />
      <string name="xfa.shippingAddressLink" optional="No" />
      <string name="xfa.shippingOptionsLink" optional="No" />
      <string name="xfa.paymentMethodLink" optional="No" />
      <string name="checkoutLoginBand" scope="variables" optional="Yes" default="" />
      <string name="checkoutCustomerDetailsBand" scope="variables" optional="Yes" default=""
	   />
      <string name="checkoutShippingAddressBand" scope="variables" optional="Yes" default=""
	   />
      <string name="checkoutShippingOptionsBand" scope="variables" optional="Yes" default=""
	   />
      <string name="checkoutPaymentMethodBand" scope="variables" optional="Yes" default=""
	   />
      <string name="checkoutConfirmationBand" scope="variables" optional="Yes" default="" />
      <string name="checkoutReceiptBand" scope="variables" optional="Yes" default="" />
    </in>
    <out>
    </out>
  </io>
</fusedoc>
--->
<cfset bandsList =
 "Login,CustomerDetails,ShippingAddress,ShippingOptions,PaymentMethod,Confirmation,Receipt">

<cfset bandContentMask = 0>
<cfloop list="#bandsList#" index="thisBand">
  <cfparam name="checkout#thisBand#Band" default="">
  <cfset thisBandPower = (ListFind(bandsList,thisBand) - 1)>
  <!--- Add a flag to the bitmask if this band has content --->
  <cfif Variables['checkout' & thisBand & 'Band'] GT "">
    <cfset bandContentMask = bandContentMask + (2^thisBandPower)>
  </cfif>
</cfloop>

<cfset gotFocusColor = "ffee99">
<cfset notFocusColor = "ddddcc">


<cfoutput>
<table width="100%">

<cfloop list="#bandsList#" index="thisBand">
  <cfset thisBandIndex = ListFind(bandsList,thisBand)>
  <cfset thisBandPower = (ListFind(bandsList,thisBand) - 1)>
  <cfset "#thisBand#LinkOpen" = "">
  <cfset "#thisBand#LinkClose" = "">
  <!--- If any bands greater than this one have content, this one's header needs a link --->
  <cfif (bandContentMask GT 2^thisBandPower) AND (thisBandIndex LT ListLen(bandsList) - 1)>
    <cfset "#thisBand#LinkOpen" = "<a
	 href=""#request.self#?#application.fusebox.fuseactionVariable#=#xfa[thisBand &
	  'Link']#"">">
    <cfset "#thisBand#LinkClose" = "</a>">
  </cfif>
  <cfif Variables['checkout' & thisBand & 'Band'] GT "">
    <cfset "#thisBand#BG" = gotFocusColor>
  <cfelse>
    <cfset "#thisBand#BG" = notFocusColor>
  </cfif>
  <tr bgcolor="#variables[thisBand & 'BG']#">
    <td height="18"> 
      <b class="labelstrong">#variables[thisBand & 'LinkOpen']##thisBandIndex#)
	   #thisBand##variables[thisBand & 'LinkClose']#</b>
    </td>
  </tr>
  <cfoutput>#variables['checkout' & thisBand & 'Band']#</cfoutput>
</cfloop>

</table>
</cfoutput>