<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ricardo Parente&#039;s Blog &#187; Tutorials</title>
	<atom:link href="http://ricardo.parente.us/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://ricardo.parente.us</link>
	<description>ColdFusion Developers Network</description>
	<lastBuildDate>Fri, 10 Feb 2012 17:13:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Fusebox 5.51 with MVC Tutorial &#8211; Part 2 New Edition</title>
		<link>http://ricardo.parente.us/2011/11/fusebox-5-51-with-mvc-tutorial-part-2-new-edition/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fusebox-5-51-with-mvc-tutorial-part-2-new-edition</link>
		<comments>http://ricardo.parente.us/2011/11/fusebox-5-51-with-mvc-tutorial-part-2-new-edition/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 01:07:30 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Fusebox]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[fusebox 5.51]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=6188</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  fopen(/7f273c45c7acd90c744dbd2d92f0a0022e5c97a2) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  fopen(/5b9a203b8fc16897d6f4f37b234d72046eb44e84) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  fopen(/240ec92fd15b1f7139b6afdc6b2b7425d855c363) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  fopen(/e264ec6ca959d65fa484c58e874832c03dd530e7) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  fopen(/edfaa846fe2455b7c50b9483845446b6edf82a88) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  fopen(/b6283c0ca8cb3a09fbf3176866dac3a878b0da24) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
If you missed the part 1 of this tutorial, you may get it here. Now that we have set up the main Fusebox structure for our application, let&#8217;s continue to implement it. Layouts I want you to pay particular attention to the circuit &#8220;layout&#8221;. That circuit will not be called by any page, it is [...]]]></description>
			<content:encoded><![CDATA[<br />
<b>Warning</b>:  fopen(/7f273c45c7acd90c744dbd2d92f0a0022e5c97a2) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  fopen(/5b9a203b8fc16897d6f4f37b234d72046eb44e84) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  fopen(/240ec92fd15b1f7139b6afdc6b2b7425d855c363) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  fopen(/e264ec6ca959d65fa484c58e874832c03dd530e7) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  fopen(/edfaa846fe2455b7c50b9483845446b6edf82a88) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  fopen(/b6283c0ca8cb3a09fbf3176866dac3a878b0da24) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home1/ricards2/public_html/wp-content/plugins/fv-code-highlighter/Includes/Cache.php</b> on line <b>69</b><br />
<p>If you missed the part 1 of this tutorial, you may get it <a title="Fusebox 5.51 With MVC Tutorial Part 1" href="http://ricardo.parente.us/2011/11/fusebox-5-51-with-mvc-tutorial-part-1-new-edition//" target="_self"><strong>here</strong></a>.<br />
Now that we have set up the main Fusebox structure for our application, let&#8217;s continue to implement it.</p>
<h3>Layouts</h3>
<div id="attachment_925" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-925" title="Figure 2.1" src="http://ricardo.parente.us/wp-content/uploads/2009/09/FBTutorial-04-001-300x199.jpg" alt="Figure 2.1" width="300" height="199" /><p class="wp-caption-text">Figure 2.1</p></div>
<p>I want you to pay particular attention to the circuit &#8220;layout&#8221;. That circuit will not be called by any page, it is an internal circuit, basically a &#8220;view&#8221; circuit which will assemble all the contents of the page into the layout templates we choose.</p>
<p>Now that we have our “Hello World” page working, let’s play a little with layouts. Suppose you want to have a header, content and footer as your layout (Figure 2.1). First you will have to create the contents for the header, main content and footer blocks and then insert them into the layout template. Let’s see how it is done.<br />
On the fusebox.xml.cfm template there is a tag <em>&lt;globalfuseactions&gt;</em>, followed by two tags <em>&lt;preprocess&gt;</em> and<em> &lt;postprocess&gt;</em>. Every action that you include between those tags will be processed either before or after Fusebox assembles the page.</p>
<p>We will set the header, footer and the layout actions into the<em> &lt;postprocess&gt;</em> tag, because they will be shown at the end of all Fusebox processing.<br />
<span id="more-6188"></span> The code is:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre>
<pre><span class="html"><span class="html-other-element">&lt;globalfuseactions&gt;</span>
<span class="html-other-element">&lt;preprocess&gt;</span>
<span class="html-other-element">&lt;/preprocess&gt;</span>
<span class="html-other-element">&lt;postprocess&gt;</span>
<span class="html-other-element">&lt;fuseaction action=<span class="html-attribute">&quot;vhome.header&quot;</span> contentvariable=<span class="html-attribute">&quot;content.header&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;fuseaction action=<span class="html-attribute">&quot;vhome.footer&quot;</span> contentvariable=<span class="html-attribute">&quot;content.footer&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;fuseaction action=<span class="html-attribute">&quot;layout.checkLayout&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;/postProcess&gt;</span>
<span class="html-other-element">&lt;/globalfuseaction&gt;</span></span></pre>
</div>
<p>Note, in the <em>&lt;postprocess&gt;</em> block, the attribute “contentvariable” in the fuseaction tag. That means Fusebox will process that action and will place the results into a variable instead of rendering it to the screen. Later on, we will use that variable in the layout context. We are calling actions from the “view” of the home circuit. That’s why we are calling the fuseactions <em>vhome.header</em> and <em>vhome.footer</em> before the <em>layout.checklayout</em>, because we want to load the header and footer into variables that will be used in the layout template.</p>
<p>So, let’s work now on the “layout” circuit and prepare the header, footer and default layout templates.</p>
<p>Create a ColdFusion template named dspHeader.cfm and another dspFooter.cfm inside the “home view” folder: <em>\circuits\home\vhome.</em> Add the following code to the templates:</p>
<p>dspHeader.cfm</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
</pre>
<pre><span class="html"><span class="html-other-element">&lt;cfoutput&gt;</span>
<span class="html-other-element">&lt;h2&gt;</span>#request.pageTitle#<span class="html-other-element">&lt;/h2&gt;</span>
<span class="html-other-element">&lt;hr/&gt;</span>
<span class="html-other-element">&lt;/cfoutput&gt;</span></span></pre>
</div>
<p>dspFooter.cfm</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
</pre>
<pre>&lt;hr/&gt;
&lt;h4&gt;&copy;2009 Your Name&lt;/h4&gt;</pre>
</div>
<p>Now, let&#8217;s edit the <em>circuit.xml.cfm</em> template in the &#8220;vhome&#8221; circuit:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre>
<pre><span class="html"><span class="html-other-element">&lt;!DOCTYPE circuit&gt;</span>
<span class="html-other-element">&lt;? xml version=<span class="html-attribute">&quot;1.0&quot;</span> encoding=<span class="html-attribute">&quot;UTF-8&quot;</span>?&gt;</span>
<span class="html-comment">&lt;!-- vhome --&gt;</span>
<span class="html-other-element">&lt;circuit access=<span class="html-attribute">&quot;internal&quot;</span> xmlns:cf=<span class="html-attribute">&quot;cf/&quot;</span>&gt;</span>
<span class="html-other-element">&lt;fuseaction name=<span class="html-attribute">&quot;main&quot;</span>&gt;</span>
<span class="html-other-element">&lt;set name=”request.pageTitle” value=”Fusebox Tutorial” overwrite=”true” /&gt;</span>
<span class="html-other-element">&lt;include template=<span class="html-attribute">&quot;dspMain&quot;</span> required=<span class="html-attribute">&quot;true&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;/fuseaction&gt;</span>
<span class="html-other-element">&lt;fuseaction name=<span class="html-attribute">&quot;header&quot;</span>&gt;</span>
<span class="html-other-element">&lt;include template=<span class="html-attribute">&quot;dspHeader&quot;</span> required=<span class="html-attribute">&quot;true&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;/fuseaction&gt;</span>
<span class="html-other-element">&lt;fuseaction name=<span class="html-attribute">&quot;footer&quot;</span>&gt;</span>
<span class="html-other-element">&lt;include template=<span class="html-attribute">&quot;dspFooter&quot;</span> required=<span class="html-attribute">&quot;true&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;/fuseaction&gt;</span>
<span class="html-other-element">&lt;/circuit&gt;</span></span></pre>
</div>
<p>With that, we accomplished the Header and Footer to be included in our layout. Notice the setting of the variable <em>request.pageTitle</em> with an attribute of <em>overwrite=’true’</em>; that will be used in the header when included into the layout template. Now, let’s look at the layout itself.</p>
<p>You noticed the call to the layout fuseaction in the fusebox.xml.cfm under the tag <em>&lt;postprocess&gt;</em> in the global fuseactions section:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
</pre>
<pre><span class="html"><span class="html-other-element">&lt;postprocess&gt;</span>
<span class="html-other-element">&lt;fuseaction action=<span class="html-attribute">&quot;layout.checkLayout&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;/postProcess&gt;</span></span></pre>
</div>
<p>That fuseaction will call the “checkLayout” fuse in the circuit “layout”, and it will check if we want to use a layout or which layout template to load.<br />
So, let’s write that “checkLayout” in <em>\circuits\layout\circuit.xml.cfm</em>:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre>
<pre><span class="html"><span class="html-other-element">&lt;? xml version=<span class="html-attribute">&quot;1.0&quot;</span> encoding=<span class="html-attribute">&quot;UTF-8&quot;</span>?&gt;</span>
<span class="html-other-element">&lt;!DOCTYPE circuit&gt;</span>
<span class="html-comment">&lt;!-- circuit: LAYOUT --&gt;</span>
<span class="html-other-element">&lt;circuit access=<span class="html-attribute">&quot;internal&quot;</span> xmlns:cf=<span class="html-attribute">&quot;cf/&quot;</span>&gt;</span>
<span class="html-other-element">&lt;fuseaction name=<span class="html-attribute">&quot;checkLayout&quot;</span>&gt;</span>
<span class="html-other-element">&lt;set name=<span class="html-attribute">&quot;request.useLayout&quot;</span> value=<span class="html-attribute">&quot;default&quot;</span> overwrite=<span class="html-attribute">&quot;false&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;if condition=<span class="html-attribute">&quot;request.useLayout is 'default'&quot;</span>&gt;</span>
<span class="html-table-element">&lt;true&gt;</span>
<span class="html-other-element">&lt;include template=<span class="html-attribute">&quot;layDefault&quot;</span> required=<span class="html-attribute">&quot;true&quot;</span> /&gt;</span>
<span class="html-table-element">&lt;/true&gt;</span>
<span class="html-other-element">&lt;/if&gt;</span>
<span class="html-other-element">&lt;if condition=<span class="html-attribute">&quot;request.useLayout is 'brochure'&quot;</span>&gt;</span>
<span class="html-table-element">&lt;true&gt;</span>
<span class="html-other-element">&lt;include template=<span class="html-attribute">&quot;layBrochure&quot;</span> required=<span class="html-attribute">&quot;true&quot;</span> /&gt;</span>
<span class="html-table-element">&lt;/true&gt;</span>
<span class="html-other-element">&lt;/if&gt;</span>
<span class="html-other-element">&lt;/fuseaction&gt;</span>
<span class="html-other-element">&lt;/circuit&gt;</span></span></pre>
</div>
<p>First we set a default value for the variable <em>“request.useLayout” </em>with the attribute <em>“overwrite”</em> to <em>“false”</em> because we don’t want overwrite it in case it already exists.</p>
<p>Then we start checking for its value, if it is “default”, include the default template, if it is “brochure” then include the brochure layout template, and so on (you may have as many layouts you want).</p>
<p>Have you noticed that you do not need to write the file extension .cfm for the template names in the<em> &lt;include&gt;</em> tag? Fusebox will assume you are loading ColdFusion templates if you do not specify the file extension.</p>
<p>Now that we have the header, footer and layout calls, let’s work on the default layout template in <em>\circuits\layout\layDefault.cfm</em>:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre>
<pre><span class="html"><span class="html-other-element">&lt;cfparam name=<span class="html-attribute">&quot;content.header&quot;</span> default=<span class="html-attribute">&quot;This is the Header&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;cfparam name=<span class="html-attribute">&quot;content.footer&quot;</span> default=<span class="html-attribute">&quot;This is the Footer&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;cfparam name=<span class="html-attribute">&quot;content.mainContent&quot;</span> default=<span class="html-attribute">&quot;This is the main content&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;cfparam name=<span class="html-attribute">&quot;request.pageTitle&quot;</span> default=<span class="html-attribute">&quot;FPTutorial&quot;</span> /&gt;</span>
<span class="html-other-element">&lt;html&gt;</span>
<span class="html-other-element">&lt;head&gt;</span>
<span class="html-other-element">&lt;cfoutput&gt;</span><span class="html-other-element">&lt;title&gt;</span>#request.pageTitle#<span class="html-other-element">&lt;/title&gt;</span><span class="html-other-element">&lt;/cfoutput&gt;</span>
<span class="html-other-element">&lt;/head&gt;</span>
<span class="html-other-element">&lt;body&gt;</span>
<span class="html-other-element">&lt;cfoutput&gt;</span>
<span class="html-other-element">&lt;p&gt;</span>#content.header#<span class="html-other-element">&lt;/p&gt;</span>
<span class="html-other-element">&lt;p&gt;</span>#content.mainContent#<span class="html-other-element">&lt;/p&gt;</span>
<span class="html-other-element">&lt;p&gt;</span>#content.footer#<span class="html-other-element">&lt;/p&gt;</span>
<span class="html-other-element">&lt;/cfoutput&gt;</span>
<span class="html-other-element">&lt;/body&gt;</span>
<span class="html-other-element">&lt;/html&gt;</span></span></pre>
</div>
<p>Run your application and you should receive a page like Figure 2.2.</p>
<div id="attachment_929" class="wp-caption alignright" style="width: 241px"><img class="size-full wp-image-929" title="FBTutorial-02-002" src="http://ricardo.parente.us/wp-content/uploads/2009/09/FBTutorial-02-002.jpg" alt="Figure 2.2" width="231" height="195" /><p class="wp-caption-text">Figure 2.2</p></div>
<p>On the next part of this tutorial we will work with some content for the main page, to replace the &#8220;Hello World&#8221;.</p>
<p>The idea is to make you comfortable with the framework showing where to add fuses, variables, include templates, etc.</p>
<p>Just keep in mind that if you are using layouts, you must create all your content, save it to variables before Fusebox finishes processing and throwing the layout page.</p>
<p>Thank you for your interest and feel free to write any comment to this post.</p>
<p><a title="Download Files for this Tutorial" href="http://ricardo.parente.us/wp-content/uploads/2009/09/FBTutorial.zip" target="_blank"><strong>Download here</strong></a> the zip file with the files for this tutorial. Please note that the fusebox.xml.cfm contain commented circuits for future development.</p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2011/11/fusebox-5-51-with-mvc-tutorial-part-2-new-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fusebox 5.51 with MVC Tutorial &#8211; Part 1 New Edition</title>
		<link>http://ricardo.parente.us/2011/11/fusebox-5-51-with-mvc-tutorial-part-1-new-edition/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fusebox-5-51-with-mvc-tutorial-part-1-new-edition</link>
		<comments>http://ricardo.parente.us/2011/11/fusebox-5-51-with-mvc-tutorial-part-1-new-edition/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 01:01:42 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Fusebox]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[fusebox 5.51]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=6185</guid>
		<description><![CDATA[Unfortunately something happened to my old tutorial when I switched Internet provider and the posts were messed up, I got some complains, so I&#8217;m re-posting them here. This is Part 1: I work with Fusebox framework since its version 2. Now we are at version 5.51. I decided to write this tutorial to help some [...]]]></description>
			<content:encoded><![CDATA[<p>Unfortunately something happened to my old tutorial when I switched Internet provider and the posts were messed up, I got some complains, so I&#8217;m re-posting them here.<br />
This is Part 1:</p>
<p>I work with Fusebox framework since its version 2. Now we are at version 5.51. I decided to write this tutorial to help some friends who haven&#8217;t got into Fusebox yet but are anxious to jump into the bandwagon, just don&#8217;t know how to start. I recommend Jeff Peter’s books on Fusebox for those who really want to take advantage of this framework:</p>
<ul>
<li><a title="Fusebox 5 &amp; Flip Master Class" href="http://www.cafepress.com/protonarts.126485280" target="_blank"><strong>Fusebox 5 &amp; Flip Master-Class ColdFusion Applications</strong></a></li>
<li><a title="How to Drive Fusebox 5.5" href="http://www.cafepress.com/protonarts.297794563" target="_blank"><strong> How to Drive Fusebox 5.5 </strong></a></li>
</ul>
<p><span id="more-6185"></span></p>
<h3>MVC &#8211; Model View Controller</h3>
<p>Before going into the framework, let&#8217;s talk a little about MVC (Model, View, Controller). For those who don&#8217;t know MVC, it is a method of separating the presentation, action and control layers of the application in order to achieve better and secure way of programming, and easier maintenance.</p>
<p>All external calls (from the web URL) are directed to the Control layer. Then the Control will decide which actions to take, like performing a query, a calculation, etc&#8230; That is done in the Model layer, which has no access from the outside world. Then the Control will submit the results to the View (presentation layer) which will assemble the contents to the public. Basically, all public link addresses to your website will be calling the Control layer. All your queries and action pages will be in the Model, and all your display pages will be in the View, easy to find and maintain.</p>
<p>Example: if you have to show a list of real estate properties, the Control will call a query in the Model to obtain the data and then call a display page in the View to show all the properties selected in the query.</p>
<h3>Fusebox</h3>
<div id="attachment_781" class="wp-caption alignright" style="width: 112px"><img class="size-medium wp-image-781 " title="FBTutorial-01-000" src="http://ricardo.parente.us/wp-content/uploads/2009/08/FBTutorial-01-000-127x300.jpg" alt="Figure 1.1" width="102" height="240" /><p class="wp-caption-text">Figure 1.1</p></div>
<p>Fusebox is a methodology for developing web applications. It protects your application by forcing all calls to be made to a single template: index.cfm, which acts as the hub where all connections are made. By passing the &#8220;fuseaction&#8221; attribute, you will tell the Fusebox framework what action you want to be executed.</p>
<p>So, with the analogy to the &#8220;electric fusebox&#8221;, the framework is divided into &#8220;circuits&#8221; and &#8220;fuses&#8221;. Your application folders are called &#8220;circuits&#8221; and the ColdFusion templates are the &#8220;fuses&#8221;.</p>
<p>In this tutorial we will be referencing the Fusebox 5.51 XML version, not the non-xml one (sort of OO). Let&#8217;s start by downloading the <a title="Fusebox 5.51 Core Files" href="http://fusebox.org/go/fusebox-downloads/core-files" target="_blank"><strong>Fusebox 5.51 Core Files</strong></a>, select the first link: Official FB5.5.1/CFMX core files (v5.5.1).</p>
<p>Unzip the contents to a folder named &#8220;fusebox5&#8243; inside your web application root if you <strong>DO NOT</strong> have access to the ColdFusion administration site. Otherwise, extract the contents to a folder outside your web root and then map it as &#8220;/fusebox5&#8243;. Doing that, you will be able to have multiple websites using the same Fusebox core installation.</p>
<p>Your Fusebox core structure should be like <em>Figure 1.1</em> side.</p>
<div id="attachment_785" class="wp-caption alignright" style="width: 234px"><img class="size-full wp-image-785" title="FBTutorial-01-003" src="http://ricardo.parente.us/wp-content/uploads/2009/08/FBTutorial-01-003.jpg" alt="Figure 1.2" width="224" height="82" /><p class="wp-caption-text">Figure 1.2</p></div>
<p>We are going to create a web application for a store called FBTutorial. Here are the initial application requirements:</p>
<ul>
<li>Home Page with News Articles</li>
<li>Contact Page &#8211; form</li>
<li>Products page &#8211; catalog</li>
<li>Shopping Cart</li>
</ul>
<div id="attachment_783" class="wp-caption alignright" style="width: 108px"><img class="size-medium wp-image-783 " title="FBTutorial-01-001b" src="http://ricardo.parente.us/wp-content/uploads/2009/08/FBTutorial-01-001b-122x300.jpg" alt="Figure 1.3" width="98" height="240" /><p class="wp-caption-text">Figure 1.3</p></div>
<p>I know two ways of creating the MVC structure for a Fusebox application. One is most used by creating 3 folders: <em>_model</em>,<em> _view</em> and <em>_controller</em> (the underscores are for placing the folders on top of the other regular ones), and inside those folders we would put the Fusebox circuits.</p>
<p>I find that more complicated and less modular. Any maintenance you need to do, you will have to look at the subfolders inside other subfolders, etc&#8230; (<em>figure 1.3</em>)</p>
<p>If you want to turn a circuit into a module that could be copied to other application, the better approach should be creating the circuits first, and then inside each circuit you create the folders &#8220;model&#8221; and &#8220;view&#8221;, being the circuit root itself working as the &#8220;controller&#8221;.</p>
<p>So I chose the second structure by creating the circuit folders and</p>
<div id="attachment_782" class="wp-caption alignright" style="width: 120px"><img class="size-full wp-image-782 " title="FBTutorial-01-001" src="http://ricardo.parente.us/wp-content/uploads/2009/08/FBTutorial-01-001.jpg" alt="Figure 1.4" width="110" height="153" /><p class="wp-caption-text">Figure 1.4</p></div>
<p>then their subfolders model and view (<em>Figure 1.4</em>). Here is how we will create the application structure:</p>
<ul>
<li>FBTutorial
<ul>
<li>circuits
<ul>
<li>forms</li>
<li>home</li>
<li>news</li>
<li>products</li>
<li>shopping</li>
</ul>
</li>
<li>other folders&#8230;</li>
</ul>
</li>
</ul>
<p>Now, inside each circuit folder, we will create the folders &#8220;<em>model</em>&#8221; and &#8220;<em>view</em>&#8220;. You decide</p>
<div id="attachment_786" class="wp-caption alignright" style="width: 132px"><img class="size-full wp-image-786 " title="FBTutorial-01-004" src="http://ricardo.parente.us/wp-content/uploads/2009/08/FBTutorial-01-004.jpg" alt="Figure 1.5" width="122" height="145" /><p class="wp-caption-text">Figure 1.5</p></div>
<p>if you want to prefix them with underscore &#8220;_&#8221;, since you will not have any other folder in the circuits.</p>
<p>After creating all the necessary folders, we need to create empty control files in each folder. Those files will be named &#8220;circuit.xml.cfm&#8221;, which are XML files but with the extention CFM so they cannot be read by the browser without being parsed by ColdFusion. Just create the empty files for now.</p>
<p><em>Figure 1.5</em> shows the new structure with the XML files.</p>
<p>Do not worry about the empty files, we will fill them in later.</p>
<div id="attachment_788" class="wp-caption alignright" style="width: 140px"><img class="size-full wp-image-788 " title="FBTutorial-01-005" src="http://ricardo.parente.us/wp-content/uploads/2009/08/FBTutorial-01-005.jpg" alt="Figure 1.6" width="130" height="96" /><p class="wp-caption-text">Figure 1.6</p></div>
<p>I&#8217;m just preparing the application structure before starting coding.</p>
<p>Now, let&#8217;s create the Fusebox required and optional files on the application root. Starting with the <em>Application.cfc</em> (capital &#8220;A&#8221;),<em> fusebox.appinit.cfm</em>, <em>fusebox.init.cfm</em>, f<em>usebox.xml.cfm</em> and <em>index.cfm</em> (create those empty files and we&#8217;ll work on them next. Your structure now should be like <em>Figure 1.6.</em></p>
<h3>Application Root</h3>
<p>Let&#8217;s start now working on the Fusebox files on the application root. First of all, the <em>Application.cfc</em> component which is always the first to run on each request.<br />
The basic methods in the Application.cfc component are:</p>
<ul>
<li>onApplicationStart,</li>
<li>onApplicationEnd,</li>
<li>onSessionStart,</li>
<li>onSessionEnd,</li>
<li>onRequestStart</li>
</ul>
<p>You may have additional methods like onRequestEnd, onError&#8230; but right now we are interested in the Fusebox method:<strong> onFuseboxApplicationStart</strong>. That method is called when the Fusebox application initiates. It replaces the template <em>fusebox.appinit.cfm</em> in the application root. So if you may decide to use this method instead of that template, then it’s one less file to maintain.</p>
<p>Here is our <em>Application.cfc</em> template:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
</pre>
<pre>&lt;cfcomponent extends=&quot;fusebox5.Application&quot; output=&quot;false&quot;&gt;
&lt;cfscript&gt;
this.name = right(REReplace(expandPath(&#039;.&#039;),&#039;[^A-Za-z]&#039;,&#039;&#039;,&#039;all&#039;),64);
this.applicationTimeout = createTimeSpan(0,6,0,0);
this.sessionManagement = true;
this.sessionTimeout = createTimeSpan(0,0,30,0);
this.clientManagement = true;
this.mainDSN = &quot;myDSN&quot;;
this.webmasterEmail = &quot;myEmail@myDomain.com&quot;;
&lt;/cfscript&gt;
&lt;!--- trap non-index.cfm requests - must be outside onXxxYyy() handlers ---&gt;
&lt;cfif right(cgi.script_name, len(&quot;index.cfm&quot;)) neq &quot;index.cfm&quot; and
right(cgi.script_name, 3) neq &quot;cfc&quot;&gt;
&lt;cflocation url=&quot;index.cfm&quot; addtoken=&quot;no&quot; /&gt;
&lt;/cfif&gt;
&lt;cffunction name=&quot;onApplicationStart&quot; returntype=&quot;boolean&quot; output=&quot;false&quot;&gt;
&lt;cfreturn True&gt;
&lt;/cffunction&gt;
&lt;cffunction name=&quot;onApplicationEnd&quot; output=&quot;false&quot;&gt;
&lt;cfargument name=&quot;applicationScope&quot; required=&quot;true&quot; /&gt;
&lt;/cffunction&gt;
&lt;cffunction name=&quot;onSessionStart&quot; output=&quot;false&quot;&gt;
&lt;/cffunction&gt;
&lt;cffunction name=&quot;onSessionEnd&quot; output=&quot;false&quot;&gt;
&lt;/cffunction&gt;
&lt;cffunction name=&quot;onFuseboxApplicationStart&quot;&gt;
&lt;cfset super.onFuseboxApplicationStart() /&gt;
&lt;!--- code formerly in fusebox.appinit.cfm ---&gt;
&lt;cfif not structKeyExists(application,&quot;mainDSN&quot;)&gt;
&lt;cflock name=&quot;mainDSN&quot; type=&quot;exclusive&quot; timeout=&quot;10&quot;&gt;
&lt;cfset application.mainDSN = this.mainDSN /&gt;
&lt;/cflock&gt;
&lt;/cfif&gt;
&lt;/cffunction&gt;
&lt;cffunction name=&quot;onRequestStart&quot;&gt;
&lt;cfargument name=&quot;targetPage&quot; /&gt;
&lt;cfscript&gt;
super.onRequestStart(arguments.targetPage);
//code formerly in fusebox.init.cfm
self = myFusebox.getSelf();
myself = myFusebox.getMyself();
if (listFirst(CGI.SERVER_NAME, &quot;.&quot;) == &quot;www&quot;) {
FUSEBOX_PARAMETERS.mode = &quot;production&quot; ;
} else {
FUSEBOX_PARAMETERS.mode = &quot;development-circuit-load&quot; ;
}
// request scope
request.applicationName = this.name;
request.mainDSN = this.mainDSN;
request.webmasterEmail = this.webmasterEmail;
request.baseDir = GetDirectoryFromPath(GetBaseTemplatePath());
request.componentPath = &quot;assets.components.&quot;;
request.imagePath = &quot;assets/images/&quot;;
request.cssPath = &quot;assets/css/&quot;;
request.jsPath = &quot;assets/js/&quot;;
request.flashPath = &quot;assets/multimedia/&quot;;
request.videoPath = &quot;assets/multimedia/&quot;;
request.ppsPath = &quot;assets/multimedia/&quot;;
&lt;/cfscript&gt;
&lt;/cffunction&gt;
&lt;/cfcomponent&gt;</pre>
</div>
<p>Now, here is the deal. Since the Fusebox core also has an Application.cfc with the same methods, we need to extend our Application.cfc to the Fusebox one and make use of the &#8220;call super&#8221; to invoke those methods first in order to use ours. On the first line, we extend the component. Remember to map /fusebox5 in your ColdFusion adminstration to the folder were you saved the core files.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre>&lt;cfcomponent extends=&quot;fusebox5.Application&quot; output=&quot;false&quot;&gt;</pre>
</div>
<p>The method onFuseboxApplicationStart must have the call super:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
</pre>
<pre>&lt;cffunction name=&quot;onFuseboxApplicationStart&quot;&gt;
&lt;cfset super.onFuseboxApplicationStart() /&gt;
… … …</pre>
</div>
<p>onRequestStart should have also the call super:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
</pre>
<pre>&lt;cffunction name=&quot;onRequestStart&quot;&gt;
&lt;cfargument name=&quot;targetPage&quot; /&gt;
&lt;cfscript&gt;
super.onRequestStart(arguments.targetPage);
… … …</pre>
</div>
<p>Some code that was formerly in fusebox.init.cfm:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
</pre>
<pre>self = myFusebox.getSelf();
myself = myFusebox.getMyself();
if (listFirst(CGI.SERVER_NAME, &quot;.&quot;) == &quot;www&quot;) {
FUSEBOX_PARAMETERS.mode = &quot;production&quot; ;
} else {
FUSEBOX_PARAMETERS.mode = &quot;development-circuit-load&quot; ;
}</pre>
</div>
<h4>Fusebox.init.cfm</h4>
<p>We basically wrote all the necessary code for starting with the Application.cfc, now let&#8217;s concentrate on the Fusebox template fusebox.init.cfm. It is included by the framework at the start of every request. It is included within a cfsilent tag so it cannot generate output. It is intended to be for per-request initialization and manipulation of the fuseaction variables.</p>
<p>You can set attributes.fuseaction, for example, to override the default fuseaction. Fusebox 5.1 and later &#8211; set variables implicitly from the Fusebox itself.</p>
<p>Could also modify the self location here:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre>&lt;cfset myFusebox.setSelf(&quot;/myapp/start.cfm&quot;) /&gt;</pre>
</div>
<p>For now, just write the following code in your fusebox.init.cfm template:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
</pre>
<pre>&lt;cfprocessingdirective suppresswhitespace=&quot;true&quot;&gt;
&lt;!--- some future code here ---&gt;
&lt;/cfprocessingdirective&gt;</pre>
</div>
<h4>Index.cfm</h4>
<p>The index.cfm template will have only one statement:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre>&lt;cfinclude template=&quot;/fusebox5/fusebox5.cfm&quot; /&gt;</pre>
</div>
<p>In a Fusebox application the index.cfm template has no use other than to include the framework.</p>
<h4>Fusebox.xml.cfm</h4>
<p>The last file on the application root we have to work on is the fusebox.xml.cfm, which is the file that controls all the fusebox circuits, parameters, classes, plugins and global actions.<br />
In the &#8220;circuits” block we define the paths and aliases for the circuits. You may chose any name as an alias to a circuit, does not have to be the same name of the folder, you will see below that we are calling “cart” the circuit in the folder “shopping”.<br />
The “parameters” block contains Fusebox default settings, and it is customizable.<br />
Here is our fusebox.xml.cfm file:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
</pre>
<pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE fusebox&gt;
&lt;!--Example fusebox.xml control file. Shows how to define circuits, classes, parameters and global fuseactions. This is just a test namespace for the plugin custom attribute example --&gt;
&lt;fusebox xmlns:test=&quot;test&quot;&gt;
&lt;circuits&gt;
&lt;!-- Home circuit --&gt;
&lt;circuit alias=&quot;home&quot; path=&quot;circuits/home/&quot; parent=&quot;&quot; /&gt;
&lt;circuit alias=&quot;mhome&quot; path=&quot;circuits/home/model/&quot; parent=&quot;home&quot; /&gt;
&lt;circuit alias=&quot;vhome&quot; path=&quot;circuits/home/view/&quot; parent=&quot;home&quot; /&gt;
&lt;!-- Forms circuit --&gt;
&lt;circuit alias=&quot;forms&quot; path=&quot;circuits/forms/&quot; parent=&quot;home&quot; /&gt;
&lt;circuit alias=&quot;mforms&quot; path=&quot;circuits/forms/model/&quot; parent=&quot;forms&quot; /&gt;
&lt;circuit alias=&quot;vforms&quot; path=&quot;circuits/forms/view/&quot; parent=&quot;forms&quot; /&gt;
&lt;!-- News circuit --&gt;
&lt;circuit alias=&quot;news&quot; path=&quot;circuits/news/&quot; parent=&quot;home&quot; /&gt;
&lt;circuit alias=&quot;mnews&quot; path=&quot;circuits/news/model/&quot; parent=&quot;news&quot; /&gt;
&lt;circuit alias=&quot;vnews&quot; path=&quot;circuits/news/view/&quot; parent=&quot;news&quot; /&gt;
&lt;!-- Products circuit --&gt;
&lt;circuit alias=&quot;products&quot; path=&quot;circuits/products/&quot; parent=&quot;home&quot;/&gt;
&lt;circuit alias=&quot;mproducts&quot; path=&quot;circuits/products/model/&quot; parent=&quot;products&quot; /&gt;
&lt;circuit alias=&quot;vproducts&quot; path=&quot;circuits/products/view/&quot; parent=&quot;products&quot; /&gt;
&lt;!-- shopping circuit --&gt;
&lt;circuit alias=&quot;cart&quot; path=&quot;circuits/shopping/&quot; parent=&quot;home&quot; /&gt;
&lt;circuit alias=&quot;mcart&quot; path=&quot;circuits/shopping/model/&quot; parent=&quot;cart&quot; /&gt;
&lt;circuit alias=&quot;vcart&quot; path=&quot;circuits/shopping/view/&quot; parent=&quot;cart&quot; /&gt;
&lt;!-- Layout circuit --&gt;
&lt;circuit alias=&quot;layout&quot; path=&quot;circuits/layout/&quot; /&gt;
&lt;/circuits&gt;
&lt;classes&gt;
&lt;/classes&gt;
&lt;parameters&gt;
&lt;parameter name=&quot;defaultFuseaction&quot; value=&quot;home.main&quot; /&gt;
&lt;!-- you may want to change this to development-full-load mode: --&gt;
&lt;parameter name=&quot;mode&quot; value=&quot;development-full-load&quot; /&gt;
&lt;!-- change this to something more secure: --&gt;
&lt;parameter name=&quot;password&quot; value=&quot;&quot; /&gt;
&lt;parameter name=&quot;strictMode&quot; value=&quot;true&quot; /&gt;
&lt;!-- These are all default values that can be overridden:
&lt;parameter name=&quot;fuseactionVariable&quot; value=&quot;fuseaction&quot; /&gt;
&lt;parameter name=&quot;precedenceFormOrUrl&quot; value=&quot;form&quot; /&gt;
&lt;parameter name=&quot;scriptFileDelimiter&quot; value=&quot;cfm&quot; /&gt;
&lt;parameter name=&quot;maskedFileDelimiters&quot; value=&quot;htm,cfm,cfml,php,php4,asp,aspx&quot; /&gt;
&lt;parameter name=&quot;characterEncoding&quot; value=&quot;utf-8&quot; /&gt;
&lt;paramater name=&quot;strictMode&quot; value=&quot;false&quot; /&gt;
&lt;parameter name=&quot;allowImplicitCircuits&quot; value=&quot;false&quot; /&gt;
&lt;parameter name=&quot;debug&quot; value=&quot;false&quot; /&gt; --&gt;
&lt;/parameters&gt;
&lt;globalfuseactions&gt;
&lt;preprocess&gt;
&lt;/preprocess&gt;
&lt;postprocess&gt;
&lt;/postprocess&gt;
&lt;/globalfuseactions&gt;
&lt;plugins&gt;
&lt;phase name=&quot;preProcess&quot;&gt;
&lt;/phase&gt;
&lt;phase name=&quot;preFuseaction&quot;&gt;
&lt;/phase&gt;
&lt;phase name=&quot;postFuseaction&quot;&gt;
&lt;/phase&gt;
&lt;phase name=&quot;fuseactionException&quot;&gt;
&lt;/phase&gt;
&lt;phase name=&quot;postProcess&quot;&gt;
&lt;/phase&gt;
&lt;phase name=&quot;processError&quot;&gt;
&lt;/phase&gt;
&lt;/plugins&gt;
&lt;/fusebox&gt;</pre>
</div>
<p>We define the circuits in the &#8220;circuits&#8221; block by assigning an alias to the path. In the application we will call the index.cfm passing the circuit,fuse and fuseaction we want to execute. Example:</p>
<div id="attachment_867" class="wp-caption alignright" style="width: 152px"><img class="size-full wp-image-867 " title="FBTutorial-01-007" src="http://ricardo.parente.us/wp-content/uploads/2009/08/FBTutorial-01-007.jpg" alt="Figure 1.7" width="142" height="90" /><p class="wp-caption-text">Figure 1.7</p></div>
<p>index.cfm?fuseaction=home.main<br />
index.cfm?fuseaction=products.showProduct&amp;productID=1234<br />
index.cfm?fuseaction=cart.addToCart</p>
<p>With Fusebox, everything is assembled in the root. The index.cfm loads Fusebox and it prepares the request to be served without the customer seeing in which folders the templates are.<br />
We added a circuit named &#8220;layout&#8221; which will handle all the layouts for our application. Since it is for the presentation layer, we do not have to create the &#8220;model&#8221; folder. <em>Figure 1.7</em> shows an updated version of our structure.</p>
<h4>Circuit.xml.cfm</h4>
<p>Now we are going to look at the<em> circuit.xml.cfm</em> file placed in all circuits.<br />
Let&#8217;s start with the &#8220;home&#8221; main circuit, the controller one&#8221; <em>/circuits/home/circuit.xml.cfm:</em><br />
For now we will not have any actions to call, just a display page to show the homepage, then our circuit.xml.cfm file will have the following code:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
</pre>
<pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!-- home --&gt;
&lt;circuit access=&quot;public&quot; xmlns:cf=&quot;cf/&quot;&gt;
&lt;fuseaction name=&quot;main&quot;&gt;
&lt;do action=&quot;vhome.main&quot; /&gt;
&lt;/fuseaction&gt;
&lt;/circuit&gt;</pre>
</div>
<p>You noticed that we here we are calling an action on another circuit, the &#8220;vhome&#8221;, in the &#8220;view&#8221; part of the MVC, to display the homepage. If we had to calculate anything or grab any information from a database in order to populate that homepage, then we would call the &#8220;model&#8221; layer before the &#8220;view&#8221;.</p>
<p>The call to &#8220;index.cfm?fuseaction=home.main&#8221; will get to this circuit which will call the &#8220;vhome.main&#8221; fuseaction in the &#8220;view&#8221; area. Subsequently that fuseaction, &#8220;vhome.main&#8221;, will include the template &#8220;dspMain.cfm&#8221; with the contents of the homepage, and then Fusebox will assemble the full page for ColdFusion to render to the browser. Note that the attribute “access” for this circuit is set to “public”. That means it can be accessed by the web browser, it is a public fuse.</p>
<p>Here is the circuit.xml.cfm file in the &#8220;view&#8221; area:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre>
<pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE circuit&gt;
&lt;!-- vhome --&gt;
&lt;circuit access=&quot;internal&quot; xmlns:cf=&quot;cf/&quot;&gt;
&lt;fuseaction name=&quot;main&quot;&gt;
&lt;include template=&quot;dspMain.cfm&quot; required=&quot;true&quot; /&gt;
&lt;/fuseaction&gt;
&lt;/circuit&gt;</pre>
</div>
<p>In this case, the “access” attribute is set to “internal” which means this circuit can be only called by another circuit, it will not respond to browser calls.</p>
<p>The fuseaction “main” will include the template dspMain.cfm.<br />
Just for testing purpose, create the file dspMain.cfm with the following HTML code:</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre>&lt;h1&gt;Hello World&lt;/h1&gt;</pre>
</div>
<p>Now, let&#8217;s test the site. If you have ColdFusion Developer Edition installed in your machine, just browse to: &#8220;<em>http://localhost/FBtutorial</em>&#8220;. You do not have to specify any attributes, because the Fusebox configuration file (fusebox.xml.cfm) will take care of calling the default fuseaction &#8220;home.main&#8221;.<br />
You should get the page <strong>&#8220;Hellow World&#8221;</strong>.</p>
<p>On the next part we will start handling layouts.</p>
<p>I hope you have liked this tutorial and please feel free to comment if you have questions.</p>
<p><a title="Fusebox 5.51 with MVC Tutorial Part 2" href="http://ricardo.parente.us/2009/09/fusebox-5-51-with-mvc-tutorial-part-2/" target="_self"><strong>Part 2</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2011/11/fusebox-5-51-with-mvc-tutorial-part-1-new-edition/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Install ColdFusion 9 On Ubuntu 9.14 with Apache</title>
		<link>http://ricardo.parente.us/2011/01/how-to-install-coldfusion-9-on-ubuntu-9-14-with-apache/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-install-coldfusion-9-on-ubuntu-9-14-with-apache</link>
		<comments>http://ricardo.parente.us/2011/01/how-to-install-coldfusion-9-on-ubuntu-9-14-with-apache/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:19:39 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Install]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=5054</guid>
		<description><![CDATA[Ubuntu is now an officially support Operating system for ColdFusion 9. This is a guide on installing Apache and ColdFusion 9 on a clean install of Ubuntu 9.04. This starts with a clean install on Ubuntu 9.04 with no additional options selected during the install. If you are planning on running PHP side by side [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Ubuntu is now an officially support Operating system for ColdFusion 9.  This is a guide on installing Apache and ColdFusion 9 on a clean install  of Ubuntu 9.04. This starts with a clean install on Ubuntu 9.04 with no  additional options selected during the install. If you are planning on  running PHP side by side with ColdFusion my recommendation is to set up  PHP first then ColdFusion.  <strong><br />
</strong>﻿</p></blockquote>
<p><a title="http://www.jaminquimby.com/index.php/ubuntu-9/133-how-to-install-coldfusion-9-on-ubuntu-904-with-apache" href="http://www.jaminquimby.com/index.php/ubuntu-9/133-how-to-install-coldfusion-9-on-ubuntu-904-with-apache" target="_blank"><strong>Get the full article here, by Jamin Quimby.</strong></a></p>
<p>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2011/01/how-to-install-coldfusion-9-on-ubuntu-9-14-with-apache/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing ColdFusion 9 on Ubuntu Linux</title>
		<link>http://ricardo.parente.us/2011/01/installing-coldfusion-9-on-ubuntu-linux/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=installing-coldfusion-9-on-ubuntu-linux</link>
		<comments>http://ricardo.parente.us/2011/01/installing-coldfusion-9-on-ubuntu-linux/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 17:05:32 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Aaron West]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=4966</guid>
		<description><![CDATA[As I was finishing this guide on installing ColdFusion 9 on Ubuntu Linux I tweeted how many words made up the text (over 6,000). Several people commented on Twitter and Facebook saying things like: &#8220;[the length] seems a bit excessive,&#8221; and &#8220;is it that complicated?&#8221; The thing is, I&#8217;m covering much more than simply installing [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>As I was finishing this guide on installing ColdFusion 9 on Ubuntu Linux I <a href="http://twitter.com/awest/status/29280588594679808">tweeted</a> how many words made up the text (over 6,000). Several people commented  on Twitter and Facebook saying things like: &#8220;[the length] seems a bit  excessive,&#8221; and &#8220;is it that complicated?&#8221; The thing is, I&#8217;m covering  much more than simply installing ColdFusion. Overall, just installing  ColdFusion isn&#8217;t that big of a deal. But I&#8217;ve yet to see a guide or blog  post that outlines all the other topics related to getting a decent  ColdFusion server on Ubuntu up and running. That&#8217;s why I wrote this  super guide, to outline what I believe is important to know about  installing ColdFusion. Of course, I&#8217;m not covering every single possible  detail, but I believe I&#8217;ve hit on all the major topics. Along the way I  sprinkle in my own ideas, thoughts, and what I believe are best  practices. After you read this post and walk through all the  instructions you should have a very solid ColdFusion / Apache set up on  Ubuntu Linux.</p>
<p><a title="http://www.aaronwest.net/blog/index.cfm/2011/1/24/Super-Guide-Installing-ColdFusion-9-on-Ubuntu-Linux" href="http://www.aaronwest.net/blog/index.cfm/2011/1/24/Super-Guide-Installing-ColdFusion-9-on-Ubuntu-Linux" target="_blank"><strong>Here is the full article by Aaron West.</strong></a></p></blockquote>
<p>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2011/01/installing-coldfusion-9-on-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SSAS: Forecast Video Tutorial</title>
		<link>http://ricardo.parente.us/2010/12/ssas-forecast-video-tutorial/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ssas-forecast-video-tutorial</link>
		<comments>http://ricardo.parente.us/2010/12/ssas-forecast-video-tutorial/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 17:12:01 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Forecast Tool]]></category>
		<category><![CDATA[SQL Server 2008]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=4428</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="505" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/2SOr3wKf2sA?fs=1&amp;hl=en_US&amp;rel=0&amp;hd=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="505" src="http://www.youtube.com/v/2SOr3wKf2sA?fs=1&amp;hl=en_US&amp;rel=0&amp;hd=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2010/12/ssas-forecast-video-tutorial/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Uber Panel of ColdFusion Awesomeness</title>
		<link>http://ricardo.parente.us/2010/12/uber-panel-of-coldfusion-awesomeness/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=uber-panel-of-coldfusion-awesomeness</link>
		<comments>http://ricardo.parente.us/2010/12/uber-panel-of-coldfusion-awesomeness/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 22:31:21 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Seminars]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=4300</guid>
		<description><![CDATA[On December 8th at 11AM CST, there will be a free, open to the world, available over Connect, panel discussion with some of the biggest names in the ColdFusion universe. Come with questions, come with answers, but just make sure you show up. The current line up: Andy Allan Adam Lehman Andy Mathews Ben Nadel [...]]]></description>
			<content:encoded><![CDATA[<p>On December 8th at 11AM CST, there will be a free, open to the world,  available over Connect, panel discussion with some of the biggest names  in the ColdFusion universe.</p>
<p>Come with questions, come with answers, but just make sure you show up.</p>
<p>The current line up:</p>
<p>Andy Allan<br />
Adam Lehman<br />
Andy Mathews<br />
Ben Nadel<br />
Brian Kotek<br />
Charles Arehart<br />
Dan Vega<br />
Jason Dean<br />
Marc Esher<br />
Raymond Camden<br />
Rob Brooks-Bilson<br />
Scott Stroz<br />
Todd Sharp</p>
<p>Be on look out for the Connect address that Ray Camden will publish on his <a title="Ray Camden" href="http://www.coldfusionjedi.com/index.cfm/2010/12/3/Reminder--Uber-Panel-of-ColdFusion-Awesomeness" target="_blank"><strong>blog</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2010/12/uber-panel-of-coldfusion-awesomeness/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ColdFusion MeetUp: Developing Apps for iOS/Android with CSS/JS/CF/Sencha Touch, with Steve Drucker</title>
		<link>http://ricardo.parente.us/2010/12/coldfusion-meetup-developing-apps-for-iosandroid-with-cssjscfsencha-touch-with-steve-drucker/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=coldfusion-meetup-developing-apps-for-iosandroid-with-cssjscfsencha-touch-with-steve-drucker</link>
		<comments>http://ricardo.parente.us/2010/12/coldfusion-meetup-developing-apps-for-iosandroid-with-cssjscfsencha-touch-with-steve-drucker/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 05:34:00 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[MeetUp]]></category>
		<category><![CDATA[Seminars]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=4249</guid>
		<description><![CDATA[Our 12pm (US ET) talk on Thursday Dec 2 will be &#8220;Developing Applications for iOS and Android with HTML5, CSS, JavaScript, ColdFusion, and Sencha Touch&#8221;. with Steve Drucker. TOPIC DESCRIPTION: (provided by the speaker) During this one hour walkthrough you will learn about Sencha Touch &#8211; the first mobile application framework built on web standards. [...]]]></description>
			<content:encoded><![CDATA[<p>Our 12pm (US ET) talk on Thursday Dec 2 will be &#8220;Developing Applications for iOS and Android with HTML5, CSS, JavaScript, ColdFusion, and Sencha Touch&#8221;. with Steve Drucker.</p>
<p><strong>TOPIC DESCRIPTION:</strong> (provided by the speaker)</p>
<p>During this one hour walkthrough you will learn about Sencha Touch &#8211; the first mobile application framework built on web standards. Using simple JavaScript syntax you can quickly create and deploy rich, native-looking applications that are x-browser compatible with Android and iOS phones and tablets. Along the way, you&#8217;ll also learn a few really cool optimization tips for the desktop and mobile web as well as discuss important design considerations for these new form-factors. To view the sample apps prior to the lecture, access <a title="http://www.senchatouchtraining.com/" href="http://www.senchatouchtraining.com/" target="_blank">http://www.senchatouchtraining.com/</a> using Android, iOS, or desktop webkit browsers.<br />
<span id="more-4249"></span><br />
<strong>MEETING URL:</strong> <a title="http://experts.acrobat.com/cfmeetup/" href="http://experts.acrobat.com/cfmeetup/" target="_blank">http://experts.acrobat.com/cfmeetup/</a><br />
DURATION: Approx. 1 hour<br />
<strong>Meeting will be recorded.</strong> URL will be posted after meeting at <a title="http://recordings.coldfusionmeetup.com/" href="http://recordings.coldfusionmeetup.com/" target="_blank">http://recordings.coldfusionmeetup.com</a></p>
<p><strong>SPEAKER:</strong> (provided by the speaker)</p>
<p>Steve Drucker is the founder/president of Fig Leaf Software, an Adobe, Google, Paperthin, and JackBe premier-level consulting and training partner. Steve has been developing ColdFusion applications since 1995, founded the very first ColdFusion users group, was a contributing author to the very first book about ColdFusion, and has authored over a dozen hands-on, instructor-led training courses including Advanced ColdFusion 9, Administering ColdFusion, Fast Track to AJAX with ColdFusion, and Fast Track to Presto Enterprise Mashups. He is also an author of Adobe&#8217;s ColdFusion 9 certification exam. Steve has consulted on some of the largest ColdFusion sites ever deployed including Voice of America (<a title="http://www.voanews.com/" href="http://www.voanews.com/" target="_blank">www.voanews.com</a>), National Park Service (<a title="http://www.nps.gov/" href="http://www.nps.gov/" target="_blank">www.nps.gov</a>), Hasbro (<a title="http://www.hasbro.com/" href="http://www.hasbro.com/" target="_blank">www.hasbro.com</a>), and Architect of the Capitol (<a title="http://www.aoc.gov/" href="http://www.aoc.gov/" target="_blank">www.aoc.gov</a>). Fig Leaf Software is a veteran-owned small business (VSOB) on GSA schedule. Check us out at<a title="http://www.figleaf.com/" href="http://www.figleaf.com/" target="_blank"> http://www.figleaf.com</a> and <a title="http://training.figleaf.com/" href="http://training.figleaf.com/" target="_blank">http://training.figleaf.com</a>.</p>
<p><strong>WHEN:</strong> Thurs. Dec 2, 12:00pm US ET (UTC/GMT-5)</p>
<p><strong>What time is that for you?</strong> The following link shows <a title="http://permatime.com/US/Eastern/2010-12-02/12:00/" href="http://permatime.com/US/Eastern/2010-12-02/12:00/" target="_blank">what the time would be for you</a>. Here&#8217;s <a title="http://www.timeanddate.com/worldclock/fixedtime.html?year=2010&amp;month=12&amp;day=02&amp;hour=12&amp;min=00&amp;sec=0&amp;p1=25" href="http://www.timeanddate.com/worldclock/fixedtime.html?year=2010&amp;month=12&amp;day=02&amp;hour=12&amp;min=00&amp;sec=0&amp;p1=25" target="_blank">another option</a> that shows the time as US ET, and lets you choose your city from the list offered to see what time that is in your own timezone.</p>
<p><strong>RECORDING:</strong> As always, the meeting will be recorded, and the recording URL will be posted after the meeting at <a title="http://recordings.coldfusionmeetup.com/" href="http://recordings.coldfusionmeetup.com/" target="_blank">http://recordings.coldfusionmeetup.com</a>.</p>
<p><strong>PODCAST/DOWNLOADABLE RECORDINGS:</strong><br />
In addition to the streaming recording, we not also post downloadable recordings (FLV, MP3, and MP4) usually within a day after each meeting, also offered as a link from the recordings page.</p>
<p><strong>LOGGING IN:</strong> When you login to the Connect room (the <a title="http://experts.acrobat.com/cfmeetup" href="http://experts.acrobat.com/cfmeetup" target="_blank">experts.acrobat.com/cfmeetup</a> link above) to view the meeting, PLEASE USE THE &#8220;LOGIN AS GUEST&#8221; option, and USE YOUR NAME, but do NOT attempt to use your <a title="http://meetup.com/" href="http://meetup.com/" target="_blank">meetup.com</a> username/password or any Connect account. Just sign in as a guest.</p>
<p><strong>RSVP, but only if coming:</strong> We do appreciate folks RSVPing if they plan to come (using the link on this email or at the meetup site), though it&#8217;s not mandatory and it&#8217;s not a commitment. But there&#8217;s <strong>no need to RSVP if you can&#8217;t make it</strong> let alone explain why you can&#8217;t. With over 2,100 members, no worries. <img src='http://ricardo.parente.us/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong>FEEDBACK/MEETING DISCUSSION</strong>: Members will receive an email after the meeting or can click a link on the event page to offer. Note also the meeting-specific discussion area there at the bottom, in addition to the one-chance feedback feature on the right. Feel free to engage in discussions about the meeting topic.</p>
<p><strong>ADD THIS TO YOUR CALENDAR:</strong> Want to add this event to your own personal calendar? Click the link on the top of the event page, below the event title, saying, &#8220;Export to a calendar&#8221;, which offers calendar downloads for Outlook, iCal, Google, and Yahoo calendars.</p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2010/12/coldfusion-meetup-developing-apps-for-iosandroid-with-cssjscfsencha-touch-with-steve-drucker/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Configuring &amp; Maintaining Healthy ColdFusion Servers by Rob Brooks-Bilson</title>
		<link>http://ricardo.parente.us/2010/11/configuring-maintaining-healthy-coldfusion-servers-by-rob-brooks-bilson/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=configuring-maintaining-healthy-coldfusion-servers-by-rob-brooks-bilson</link>
		<comments>http://ricardo.parente.us/2010/11/configuring-maintaining-healthy-coldfusion-servers-by-rob-brooks-bilson/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 20:59:58 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Seminars]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Maintenance]]></category>
		<category><![CDATA[Rob Brooks-Bilson]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=4096</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><object width="425" height="256"><param name="movie" value="http://images.tv.adobe.com/swf/player.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="FlashVars" value="fileID=8314&#038;context=648&#038;embeded=true&#038;environment=production"></param><embed src="http://images.tv.adobe.com/swf/player.swf" flashvars="fileID=8314&#038;context=648&#038;embeded=true&#038;environment=production" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="256"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2010/11/configuring-maintaining-healthy-coldfusion-servers-by-rob-brooks-bilson/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Object Oriented Programming in Coldfusion &#8211; Presentation</title>
		<link>http://ricardo.parente.us/2010/11/object-oriented-programming-in-coldfusion-presentation/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=object-oriented-programming-in-coldfusion-presentation</link>
		<comments>http://ricardo.parente.us/2010/11/object-oriented-programming-in-coldfusion-presentation/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 17:41:19 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Seminars]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Central Georgia]]></category>
		<category><![CDATA[OO]]></category>
		<category><![CDATA[Tim Cunningham]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=4045</guid>
		<description><![CDATA[I am going to attempt to broadcast this User Group presentation via WEB-EX for any who need to be at home but would like to attend the meetin anyway. by Tim Cunningham Central Georgia ColdFusion User Group Here is the link to login to the presentation: http://cgcfug.groups.adobe.com/index.cfm?event=post.display&#38;postid=32145]]></description>
			<content:encoded><![CDATA[<blockquote><p>I am going to attempt to broadcast this User Group presentation via  WEB-EX for any who need to be at home but would like to attend the  meetin anyway.</p>
<p>by <a title="http://cgcfug.groups.adobe.com/people/91586/profile" href="http://cgcfug.groups.adobe.com/people/91586/profile" target="_blank">Tim Cunningham</a></p>
<p><a title="http://cgcfug.groups.adobe.com/" href="http://cgcfug.groups.adobe.com/" target="_blank">Central Georgia ColdFusion User Group</a></p></blockquote>
<p>Here is the link to login to the presentation: <a title="http://cgcfug.groups.adobe.com/index.cfm?event=post.display&amp;postid=32145" href="http://cgcfug.groups.adobe.com/index.cfm?event=post.display&amp;postid=32145" target="_blank">http://cgcfug.groups.adobe.com/index.cfm?event=post.display&amp;postid=32145</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2010/11/object-oriented-programming-in-coldfusion-presentation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating an URL Shortener with ColdFusion</title>
		<link>http://ricardo.parente.us/2010/10/creating-an-url-shortener-with-coldfusion/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-an-url-shortener-with-coldfusion</link>
		<comments>http://ricardo.parente.us/2010/10/creating-an-url-shortener-with-coldfusion/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 16:28:50 +0000</pubDate>
		<dc:creator>rparente</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://ricardo.parente.us/?p=3737</guid>
		<description><![CDATA[Creating an URL Shortener with ColdFusion There are several sites to use for URL shortening, like tinyUrl.com, is.gd, dwarfURL.com, bit.ly and others. I got a call from a friend who has many articles distributed with short URL and he is afraid if someday those shortening sites go down and his articles will be lost. Therefore, [...]]]></description>
			<content:encoded><![CDATA[<p>Creating an URL Shortener with ColdFusion</p>
<p>There are several sites to use for URL shortening, like tinyUrl.com, is.gd, dwarfURL.com, bit.ly and others.<br />
I got a call from a friend who has many articles distributed with short URL and he is afraid if someday those shortening sites go down and his articles will be lost.<br />
Therefore, he asked me if I could write a system to do the same thing but hosted on his server.<br />
I did it and it is working for him. I now decided to make it available for those who think the same way.</p>
<p>Our environment is Windows Server 2003, Microsoft SQL 2008 and ColdFusion 8.</p>
<p><span id="more-3737"></span></p>
<h2>Domain Name</h2>
<p>First, you need to register a short domain name and create the website. You can try <a title="www.webhostingsearch.com/free-domain-hosting.php" href="www.webhostingsearch.com/free-domain-hosting.php" target="_blank">free domain hosting</a> for that matter. Suppose you registered the domain xxx.com, and set up the DNS records.</p>
<ul>
<li>Create a folder for the site in your web root: ex:      c:\inetpub\wwwroot\xxx\
<ul>
<li>Add it to IIS</li>
</ul>
</li>
</ul>
<h2>ISAPI Rewrite</h2>
<p>In order to redirect the short URL to the target one, you need to set up the ISAPI URL rewrite.</p>
<ul>
<li>If you have IIS 5/6:
<ul>
<li>You should download the DLL and the configuration file       <a title="ISAPI Rewrite DLL and Config File" href="../wp-content/uploads/2010/10/IsapiRewrite4.zip" target="_blank"><strong>HERE</strong></a>.</li>
<li>Save the IsapiRewrite4.dll and the configuration file       (.ini) to a folder outside your web root. I saved it into       &#8220;c:\ISAPI\urlShortener\&#8221;.<br />
The configuration file is simple, and you will see the following rule:<br />
RewriteRule        ^/([^/.\?]+)$    /index.cfm?go=$1</li>
</ul>
</li>
<li>For IIS 7 (Windows Server 2008 or Windows 7):
<ul>
<li>You need to download the ISAPI rewrite tool (<a title="ISAPI URL Rewrite Tool" href="http://www.iis.net/download/URLRewrite" target="_blank"><strong>http://www.iis.net/download/URLRewrite</strong></a>)
<ul>
<li>Click on the link x86 or x64        (64-bit) on the box on the right, if you do not want to install the        Microsoft Web Platform Installer.</li>
</ul>
</li>
<li>Run the installation and your IIS will have the       &#8220;Rewrite&#8221; tool for all of your sites.</li>
<li>Configure ISAPI:
<ul>
<li>Open the IIS Manager and        select your website or virtual folder (Windows 7 localhost)</li>
<li>In the IIS group icons, click        on &#8220;URL rewrite&#8221;</li>
<li>The URL Rewrite window will        open, click on &#8220;Add Rule(s)&#8221; on the right box.</li>
<li>On the Rule Template, select        &#8220;User-friendly URL&#8221; and click OK.</li>
<li>Enter the following URL in        the input box: http://xxx.com/index.cfm?go=xyz123<br />
(replace xxx.com by your domain).</p>
<ul>
<li>IIS will show the short URL         and the pattern in the boxes below. Just click OK.</li>
</ul>
</li>
<li>Now the URL Rewrite window        will show the rule you just created.</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2>Database</h2>
<p>Next step: Setting up the database:</p>
<ul>
<li>Create a database and a table (I called the database &#8220;urlShortener&#8221; and the table &#8220;urls&#8221;).  (Scripts <a title="Database Scripts" href="../wp-content/uploads/2010/10/database.zip" target="_blank"><strong>HERE</strong></a>). (codes SP1 and SP2)</li>
<li>Create two stored procedures: dbo.setShortUrl and dbo.getShortUrl  (Scripts <a title="Stored Procedures Scripts" href="../wp-content/uploads/2010/10/storedProcs.zip" target="_blank"><strong>HERE</strong></a>).</li>
</ul>
<p>o   The stored procedure setShortUrl checks if the target URL and code passed already Exist, and if not, it saves the new target and returns the new code. (code SP3)</p>
<p>o   The stored procedure getShortUrl retrieves the target URL of a given short code.(code SP4)</p>
<h2>ColdFusion Data Source</h2>
<p>Add data source to ColdFusion Administrator: I suppose you know how to do that!</p>
<h2>CFML</h2>
<p>Now let&#8217;s work on the project in CFEclipse or CFBuilder.</p>
<ul>
<li>Create the &#8220;Application.cfc&#8221; (Code CF1)</li>
<li>Create the component &#8220;shortener.cfc&#8221; (code CF2)</li>
<li>Create the &#8220;index.cfm&#8221; (code CF3)</li>
</ul>
<p>You may download the complete code and database scripts <a href="../wp-content/uploads/2010/10/urlShortener.zip"><strong>HERE</strong></a>.</p>
<p>I hope this code is of good use for you. Please let me know if you find any error or if you have any ideas to make it work better.</p>
<h2>Code S1: Create Database urlShortener</h2>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
</pre>
<pre>USE [master]
GO
CREATE DATABASE [urlShortener] ON  PRIMARY
( NAME = N&#039;urlShortener&#039;, FILENAME = N&#039;C:\MSSQLDATA\urlShortener.mdf&#039; , SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )

LOG ON
( NAME = N&#039;urlShortener_log&#039;, FILENAME = N&#039;C:\MSSQLDATA\urlShortener_log.ldf&#039; , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 2048KB )
GO

ALTER DATABASE [urlShortener] SET COMPATIBILITY_LEVEL = 100
GO

IF (1 = FULLTEXTSERVICEPROPERTY(&#039;IsFullTextInstalled&#039;))
begin
EXEC [urlShortener].[dbo].[sp_fulltext_database] @action = &#039;enable&#039;
end
GO

ALTER DATABASE [urlShortener] SET ANSI_NULL_DEFAULT OFF
GO

ALTER DATABASE [urlShortener] SET ANSI_NULLS OFF
GO

ALTER DATABASE [urlShortener] SET ANSI_PADDING OFF
GO

ALTER DATABASE [urlShortener] SET ANSI_WARNINGS OFF
GO

ALTER DATABASE [urlShortener] SET ARITHABORT OFF
GO

ALTER DATABASE [urlShortener] SET AUTO_CLOSE OFF
GO

ALTER DATABASE [urlShortener] SET AUTO_CREATE_STATISTICS ON
GO

ALTER DATABASE [urlShortener] SET AUTO_SHRINK OFF
GO

ALTER DATABASE [urlShortener] SET AUTO_UPDATE_STATISTICS ON
GO

ALTER DATABASE [urlShortener] SET CURSOR_CLOSE_ON_COMMIT OFF
GO

ALTER DATABASE [urlShortener] SET CURSOR_DEFAULT  GLOBAL
GO

ALTER DATABASE [urlShortener] SET CONCAT_NULL_YIELDS_NULL OFF
GO

ALTER DATABASE [urlShortener] SET NUMERIC_ROUNDABORT OFF
GO

ALTER DATABASE [urlShortener] SET QUOTED_IDENTIFIER OFF
GO

ALTER DATABASE [urlShortener] SET RECURSIVE_TRIGGERS OFF
GO

ALTER DATABASE [urlShortener] SET  DISABLE_BROKER
GO

ALTER DATABASE [urlShortener] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO

ALTER DATABASE [urlShortener] SET DATE_CORRELATION_OPTIMIZATION OFF
GO

ALTER DATABASE [urlShortener] SET TRUSTWORTHY OFF
GO

ALTER DATABASE [urlShortener] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO

ALTER DATABASE [urlShortener] SET PARAMETERIZATION SIMPLE
GO

ALTER DATABASE [urlShortener] SET READ_COMMITTED_SNAPSHOT OFF
GO

ALTER DATABASE [urlShortener] SET HONOR_BROKER_PRIORITY OFF
GO

ALTER DATABASE [urlShortener] SET  READ_WRITE
GO

ALTER DATABASE [urlShortener] SET RECOVERY SIMPLE
GO

ALTER DATABASE [urlShortener] SET  MULTI_USER
GO

ALTER DATABASE [urlShortener] SET PAGE_VERIFY CHECKSUM
GO

ALTER DATABASE [urlShortener] SET DB_CHAINING OFF
GO</pre>
</div>
<h2>Code S2: Create Table urls</h2>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
</pre>
<pre>USE [urlShortener]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[urls](
[ID] [uniqueidentifier] NOT NULL,
[shortURL] [varchar](25) NULL,
[targetURL] [varchar](255) NULL,
[hitCount] [int] NULL,
[dateCreated] [datetime] NULL,
[isActive] [bit] NULL,

CONSTRAINT [PK_urls] PRIMARY KEY CLUSTERED
( [ID] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[urls] ADD  CONSTRAINT [DF_urls_ID]  DEFAULT (newid()) FOR [ID]
GO

ALTER TABLE [dbo].[urls] ADD  CONSTRAINT [DF_urls_hitCount]  DEFAULT ((0)) FOR [hitCount]
GO

ALTER TABLE [dbo].[urls] ADD  CONSTRAINT [DF_urls_dateCreated]  DEFAULT (getdate()) FOR [dateCreated]
GO

ALTER TABLE [dbo].[urls] ADD  CONSTRAINT [DF_urls_isActive]  DEFAULT ((1)) FOR [isActive]
GO</pre>
</div>
<h2>Code S3: Stored Procedure setShortURL</h2>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre>
<pre>USE [urlShortener]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:           Ricardo Parente
-- Create date: 2010-10-09
-- Description:      I try to add a new URL
-- =============================================
CREATE PROCEDURE [dbo].[setShortUrl]
@arg_shortURL varchar(25)
,   @arg_targetURL varchar(255)
AS
BEGIN
SET NOCOUNT ON;
-- check if targetURL already exists
IF (NOT EXISTS (
SELECT TOP 1 shortURL
FROM urls
WHERE targetURL = @arg_targetURL))
BEGIN
-- since targetURL does not exist, let&#039;s check if the
-- shortURL already exists
IF (NOT EXISTS (
SELECT TOP 1 shortURL
FROM urls
WHERE shortURL = @arg_shortURL))
BEGIN
-- since the shortURL and targetURL do not exist, let&#039;s add them
INSERT INTO urls (
shortURL
,   targetURL
) VALUES (
@arg_shortURL
,   @arg_targetURL
)
-- return the newly created shortURL
SELECT @arg_shortURL AS shortURL
END
ELSE
-- shortURL already exists and it is not for the given target URL, so return blank
SELECT NULL AS shortURL
END
ELSE
-- targetURL already exists, so return its shortURL
SELECT TOP 1 shortURL
FROM urls
WHERE targetURL = @arg_targetURL
END
GO</pre>
</div>
<h2>Code S4: Stored Procedure getShortURL</h2>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre>
<pre>USE [urlShortener]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:        Ricardo Parente
-- Create date: 2010-10-10
-- Description:   I retrieve one record
-- =============================================
CREATE PROCEDURE [dbo].[getShortURL]
@arg_shortURL varchar(25)
AS
BEGIN
SET NOCOUNT ON;
UPDATE urls SET
hitCount = hitCount + 1
WHERE shortURL = @arg_shortURL
SELECT TOP 1 targetURL
FROM urls
WHERE shortURL = @arg_shortURL
END</pre>
</div>
<h2>Code CF1: Aplication.cfc</h2>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre>
<pre>&lt;cfcomponent output=&quot;false&quot;&gt;
&lt;cfscript&gt;
this.name = &quot;urlShortener&quot;;
this.applicationTimeout = createTimeSpan(0,6,0,0);
this.sessionManagement = false;
this.clientManagement = false;
&lt;/cfscript&gt;
&lt;cffunction name=&quot;onApplicationStart&quot; returntype=&quot;boolean&quot; output=&quot;false&quot;&gt;
&lt;cfscript&gt;
application.mainDSN = &quot;urlShortener&quot;;
application.emailFrom = &quot;process@zzz.com&quot;;
application.emailAdmin = &quot;webmaster@zzz.com&quot;;
application.totChars = 6;
&lt;/cfscript&gt;
&lt;cfreturn True/&gt;
&lt;/cffunction&gt;

&lt;cffunction name=&quot;onApplicationEnd&quot; output=&quot;false&quot;&gt;
&lt;cfargument name=&quot;applicationScope&quot; required=&quot;true&quot; /&gt;
&lt;/cffunction&gt;

&lt;cffunction name=&quot;onRequestStart&quot;&gt;
&lt;cfargument type=&quot;String&quot; name=&quot;targetPage&quot; required=&quot;true&quot; /&gt;
&lt;cfparam name=&quot;url.appInit&quot; type=&quot;string&quot; default=&quot;false&quot; /&gt;
&lt;cfparam name=&quot;url.serverInit&quot; type=&quot;string&quot; default=&quot;false&quot; /&gt;
&lt;cfscript&gt;
if (url.appInit eq true or url.serverInit eq true)
onApplicationStart();
&lt;/cfscript&gt;
&lt;/cffunction&gt;
&lt;/cfcomponent&gt;</pre>
</div>
<h2>Code CF2: shortener.cfc</h2>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
</pre>
<pre>&lt;cfcomponent output=&quot;false&quot;&gt;
&lt;cfscript&gt;
variables.aChars =
listToArray(&quot;a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9&quot;, &quot; &quot;);
&lt;/cfscript&gt;

&lt;cffunction name=&quot;setShort&quot; access=&quot;remote&quot; output=&quot;false&quot;
returntype=&quot;Any&quot;&gt;
&lt;cfargument name=&quot;targetURL&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
&lt;cfset var myShort = &quot;&quot; /&gt;
&lt;cfset var totChars = application.totChars /&gt;
&lt;cfset var shortURL = &quot;&quot; /&gt;
&lt;!--- try up to 10 times to avoid duplicate shortURL ---&gt;
&lt;cfloop from=&quot;1&quot; to=&quot;10&quot; index=&quot;x&quot;&gt;
&lt;cfset myShort = createShort() /&gt;
&lt;cfset shortURL = saveShort(myShort,arguments.targetURL) /&gt;
&lt;cfif len(trim(shortURL))&gt;
&lt;cfbreak /&gt;
&lt;/cfif&gt;
&lt;/cfloop&gt;
&lt;cfif not len(trim(shortURL))&gt;
&lt;!--- try again with more characters ---&gt;
&lt;cfset totChars = totChars + 1 /&gt;
&lt;cfloop from=&quot;1&quot; to=&quot;10&quot; index=&quot;x&quot;&gt;
&lt;cfset myShort = createShort(totChars) /&gt;
&lt;cfset shortURL = saveShort(myShort,arguments.targetURL) /&gt;
&lt;cfif len(trim(shortURL))&gt;
&lt;cfbreak /&gt;
&lt;/cfif&gt;
&lt;/cfloop&gt;
&lt;/cfif&gt;
&lt;cfreturn shortURL /&gt;
&lt;/cffunction&gt;

&lt;cffunction name=&quot;saveShort&quot; access=&quot;private&quot; output=&quot;false&quot;
returntype=&quot;Any&quot;&gt;
&lt;cfargument name=&quot;shortURL&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
&lt;cfargument name=&quot;targetURL&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
&lt;cfset var myShortURL = &quot;&quot; /&gt;
&lt;cftry&gt;
&lt;!--- this procedure will save the url and return the shorURL generated ---&gt;
&lt;cfstoredproc procedure=&quot;dbo.setShortURL&quot; datasource=&quot;#application.mainDSN#&quot;&gt;
&lt;cfprocparam cfsqltype=&quot;CF_SQL_VARCHAR&quot; value=&quot;#arguments.shortURL#&quot; /&gt;
&lt;cfprocparam cfsqltype=&quot;CF_SQL_VARCHAR&quot; value=&quot;#arguments.targetURL#&quot; /&gt;
&lt;cfprocresult name=&quot;qShort&quot; /&gt;
&lt;/cfstoredproc&gt;
&lt;cfset myShortURL = qShort.shortURL /&gt;
&lt;cfcatch&gt;
&lt;cfmail from=&quot;#application.emailFrom#&quot; To=&quot;#application.emailAdmin#&quot; subject=&quot;Error on SetShort function&quot; Type=&quot;html&quot;&gt;
&lt;h1&gt;Error trying to set short URL&lt;/h1&gt;
&lt;cfdump var=&quot;#cfcatch#&quot;&gt;
&lt;/cfmail&gt;
&lt;cfset myShortURL = &quot;&quot; /&gt;
&lt;/cfcatch&gt;
&lt;/cftry&gt;
&lt;cfreturn myShortURL /&gt;
&lt;/cffunction&gt;

&lt;cffunction name=&quot;createShort&quot; access=&quot;private&quot; output=&quot;false&quot; returntype=&quot;Any&quot;&gt;
&lt;cfargument name=&quot;totChars&quot; type=&quot;numeric&quot; required=&quot;false&quot; default=&quot;#application.totChars#&quot; /&gt;
&lt;cfscript&gt;
var shortUrl = &quot;&quot;;
for (i=1; i lte arguments.totChars; i=i+1) {
shortUrl = shortUrl &amp; variables.aChars[randRange(1,arrayLen(variables.aChars))];
}
return shortUrl;
&lt;/cfscript&gt;
&lt;/cffunction&gt;

&lt;!--- function set to remote to be called as webservice ---&gt;
&lt;cffunction name=&quot;getShortURL&quot; access=&quot;remote&quot; output=&quot;false&quot;
returntype=&quot;Any&quot;&gt;
&lt;cfargument name=&quot;targetURL&quot; type=&quot;string&quot; required=&quot;true&quot; /&gt;
&lt;cfreturn setShort(arguments.targetURL) /&gt;
&lt;/cffunction&gt;
&lt;/cfcomponent&gt;</pre>
</div>
<h2>Code CF3: index.cfm</h2>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre>
<pre>&lt;cfparam name=&quot;url.site&quot; type=&quot;string&quot; default=&quot;&quot; /&gt;
&lt;cfparam name=&quot;url.go&quot; type=&quot;string&quot; default=&quot;&quot; /&gt;
&lt;!--- let&#039;s check if we are in development server or localhost ---&gt;
&lt;cfif listFindNoCase(&quot;localhost,127.0.0.1&quot;, cgi.host_name)&gt;
&lt;cfset baseHost = &quot;http://localhost/&quot; /&gt;
&lt;cfelse&gt;
&lt;cfset baseHost = &quot;http://lk3.us/&quot; /&gt;
&lt;/cfif&gt;

&lt;!--- if a target URL was passed, we need to create the short URL ---&gt;
&lt;cfif len(trim(url.site))&gt;
&lt;cfset short = createObject(&quot;component&quot;, &quot;shorten&quot;) /&gt;
&lt;cfif left(url.site, 7) neq &#039;http://&#039;&gt;
&lt;cfset url.site = &quot;http://&quot; &amp; url.site /&gt;
&lt;/cfif&gt;
&lt;cfset shortURL = short.setShort(url.site) /&gt;
&lt;cfif len(trim(shortURL))&gt;
&lt;cfset shortURL = baseHost &amp; shortURL /&gt;
&lt;cfoutput&gt;
The short URL for: #url.site# is: &lt;br/&gt;
&lt;a href=&quot;#shortURL#&quot;&gt;#shortURL#&lt;/a&gt;
&lt;/cfoutput&gt;
&lt;!--- if any error occurred during the creation of the short URL ---&gt;
&lt;cfelse&gt;
&lt;cfoutput&gt;
Sorry! We are experiencing problems now. Please try again later !
&lt;/cfoutput&gt;
&lt;/cfif&gt;
&lt;cfabort /&gt;

&lt;!--- check if a short URL was passed, then get the target and jump to it ---&gt;
&lt;cfelseif len(trim(url.go))&gt;
&lt;cftry&gt;
&lt;cfstoredproc procedure=&quot;dbo.getShortURL&quot; datasource=&quot;#application.mainDSN#&quot;&gt;
&lt;cfprocparam cfsqltype=&quot;CF_SQL_VARCHAR&quot; value=&quot;#url.go#&quot; /&gt;
&lt;cfprocresult name=&quot;get&quot; /&gt;
&lt;/cfstoredproc&gt;
&lt;cfcatch&gt;
&lt;cfoutput&gt;
Sorry ! Short URL unavailable !&lt;br/&gt;
#cfcatch.message#&lt;br/&gt;
#cfcatch.detail#
&lt;/cfoutput&gt;
&lt;cfabort /&gt;
&lt;/cfcatch&gt;
&lt;/cftry&gt;
&lt;!--- jump to the target ---&gt;
&lt;cfheader statuscode=&quot;301&quot; statustext=&quot;Moved Permanently&quot; /&gt;
&lt;cfheader name=&quot;Location&quot; value=&quot;#get.targetURL#&quot; /&gt;
&lt;cfelse&gt;
Please verify the query string. It should have either &quot;site&quot; or &quot;go&quot; parameters.
&lt;/cfif&gt;</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://ricardo.parente.us/2010/10/creating-an-url-shortener-with-coldfusion/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

