Blog Post

ColdFusion is a powerful engine for delivering dynamic web content and web based applications. The site you are currently reading is written mostly in ColdFusion (or CFML, Cold Fusion Markup Language) that has been enhanced with Javascript and styled with CSS. 

Just to dip your toe in the water, so to speak, here is a simple "Hello World" App in ColdFusion:

<cfset testMsg = "Hello World">
<cfoutput>
	#testMsg#
</cfoutput>

Pretty straightforward, eh? The first line is setting a variable (in this case a "string" of characters) and then the other three lines simply cause it to output. If this script was saved as a .cfm file and served from a CF server, viewing the page would result in:

 

Hello World

 

Very basic, I know, but you have to start somewhere! Lets get a little more in-depth here. After the jump, we can discuss the nitty-gritty of how the World Wide Web does it's thing, and how ColdFusion is a powerful tool in bringing that Web to life.

To understand how ColdFusion works, you have to first understand the basic principles of how web browsing works. And in order to make sure we are all on the same page, I'm going to give you a high level overview that is wordy and full of acronyms, but dont worry, I will break it down afterwards:

When you type a web address (also known as a URL or Uniform Resource Locator) into your browser, it first contacts a DNS sever (Domain Name Service) to translate the URL into an IP Address. The browser then creates an HTTP request to the webserver at that address, and waits for a response. That response usually comes back in the form of HTML (Hyper Text Markup Language), a set of simple instructions that tells the browser what to display. Click a link on that page or enter a new URL and the process starts all over again.

Ok, so lets break that down. First off we know you have a web browser - Otherwise you couldn't  be reading this site. For the most part, browsers work very similarly, though only a handful are based on the same core engine. I highly recommend using Chrome, FireFox, Opera or Safari, in that order - Avoid Internet Explorer unless you have no choice, as Microsoft loves to make up its own rules instead of following the standards that other browsers adhere to.

So now, you point your web browser to a URL - in this case, you've used either CodeGeex.com or codegeex.blogomancer.com - and it arrived here. By "arrived" I mean that your page request went out, reached our webserver, and the HTML to display this site was sent back to you. See, its actually fairly simple when you get the concept. But where does ColdFusion come in, you ask?

Well the big issue with HTML on its own is that it is not "dynamic" - which means it contains no logic, scripting or processing of its own. If you write an HTML page, that page will be the same every time you access it. Which is useful at times, but ultimately, boring.

What a ColdFusion server does is that it watches over the webserver's shoulder looking for requests for any files that end in .cfm or .cfc extensions. When a request for a ColdFusion file comes across, the ColdFusion server tells the webserver "Hey, hold on a second..." and processes any ColdFusion commands or scripts that may be in that page. It uses those scripts the create a dynamically generated HTML file, which it then hands back to webserver to pass along to your browser.

Because of this little interception, ColdFusion allows us to build pages that change based on pretty much any logic we can think of writing. In the case of this blog post you are reading right now, it is taking a set of templates I had created ahead of time, a healthy serving of data pulled from a database (that contains all these lovely words I have written), and smooshes them together into an HTML patty, after which it tells the webserver that the order is up (ding ding) and you get to dine on a lovingly prepared blog post that is golden brown and delicious.

Okay, I've gone and made myself hungry, so I will end the post here. If you have any questions about what I've explained above, let me know in the comments below. In the next post, we are going to start in the ColdFusion language itself. You wont want to miss it.

Until next time!

 

0 Comments for this post.
You must be signed in to post a comment.
Advertisement
Advertisement
This site is powered by the Blogomancer Engine

The Blogomancer Engine is built/maintained by:

The Blogomancer Engine exists thanks to the following products and services:
Related Posts
  • SQueeL like a pig!
  • SQL_101: Prequel to the SQL
  • [true] Dynamic doesnt mean much without data to drive it, and when we deal with data, most often we deal with SQL