Skip to content

Instantly share code, notes, and snippets.

learncfinaweek

Block or report user

Report or block learncfinaweek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@learncfinaweek
learncfinaweek / gist:4120971
Created Nov 20, 2012
Setup - Installing ColdFusion
View gist:4120971

To be able to program in ColdFusion, a ColdFusion server needs to be installed. There are a couple of options available, but the one that we are going to focus on is a local development server.

A local development server is free and allows you to develop ColdFusion applications that use all of ColdFusion’s available features. There are, however, a few limitations, such as not being able to use the server as an external web server. That being said, there are additional benefits to using a local ColdFusion development server, such as not needing to have IIS or Apache installed, but instead using the packaged web server.

To install ColdFusion, follow the steps below:

@learncfinaweek
learncfinaweek / gist:4120988
Created Nov 20, 2012
Setup - Installing MySQL
View gist:4120988

ColdFusion has the ability to communicate with a number of different databases, which will be covered later on in this course; for the sample application we will be working on throughout the course, we will be using MySQL. If you already have MySQL 4 or 5 already installed, you can proceed to the 'Install Sample Files' section. If not, follow the steps below:

Windows

  1. Open up a browser and go to: http://dev.mysql.com/downloads/mysql/
@learncfinaweek
learncfinaweek / gist:4121000
Created Nov 20, 2012
Setup - Installing Sample Files
View gist:4121000

As well as having the ability to read about ColdFusion, 'Learn CF in a Week' has a Hands On section of the course, giving you the opportunity to create your own ColdFusion web site. During the course, you will take a basic HTML website and add ColdFusion to it, creating a fully functional ColdFusion application.

To be able to take part in the Hands On, you must first install the necessary Application files. To do this, follow the steps below:

Windows

@learncfinaweek
learncfinaweek / gist:4121006
Created Nov 20, 2012
Basics - What is ColdFusion?
View gist:4121006

ColdFusion is a rapid development platform for building modern web applications. ColdFusion is designed to be expressive and powerful. The expressive characteristic allows you to perform programming tasks at a higher level than most other languages. The powerful characteristic gives you integration with functionality important to web applications like database access, MS Exchange access, PDF form creation and more.

The ColdFusion platform is built on Java and uses the Apache Tomcat J2EE container. While you have full access to Java and Tomcat, you need not worry about these details. You'll interact with ColdFusion and the user friendly ColdFusion Mark-up Language (CFML) to write your programs. Your ColdFusion files will use the file extension '.cfc' for objects and '.cfm' for pages. CFML requires much less ceremony and infrastructure than typical java while offering a significantly faster development experience than Java.

After taking this CF in a Week series, you'll have the basics n

@learncfinaweek
learncfinaweek / gist:4121009
Created Nov 20, 2012
Basics - Setting Variables
View gist:4121009

Programming is all about doing stuff to things. Generally, the stuff is the execution of a process or algorithm and the things are information or data.

An algorithm is just a fancy name for a series of steps, like tying your shoelaces. Information or data is just values. Your name is a piece of information and so is your birth date. Since it's shorter, in this chapter we'll use the word data to describe a piece of information.

In ColdFusion, data is held in variables. Think of a variable like a mailbox. You can stuff things like letters and packages into a mailbox and get them out later to do stuff. ColdFusion makes storing information very easy because it's a loosely typed Language. You can stick any kind of data into a ColdFusion variable without having to tell ColdFusion what kind of data it is.

View gist:4121012

In our last Section, we talked about variables, data, and how to transport data around in your application. Different data types serve different purposes.

Strings/Numbers

Is Simple: Yes

View gist:4121015

In our previous sections we talked about the importance of adding context into your programs. You’ll find you will spend much more time reading programs for the purposes of debugging and enhancing, than you spend writing the program. So take care to write your programs in such a way the program can be read and understood as easily as possible.

Context is important because our programs express a problem to a computer using a kind of shorthand, in our case ColdFusion programming code. The computer doesn’t much care about the amount of context in the application, as long as the instructions (code) are all properly formed. The program is good enough for the computer if it works well. But this doesn’t necessarily mean the program is good enough for a human. Programs that are good for humans can be efficiently understood, debugged and enhanced by another programer.

One way to add context is to use descriptive variable names.

@learncfinaweek
learncfinaweek / gist:4121048
Created Nov 20, 2012
Basics - Script vs Tag
View gist:4121048

ColdFusion has been designed to allow the use of ColdFusion tags and ColdFusion script. Functionally, both will be interpreted equally and will achieve the same result. The use of ColdFusion Tags and ColdFusion Script is up to personal or team preference. One or two ColdFusion operations are currently Tag only, as of this tutorial, but these will be made available in ColdFusion script in future releases.

Some developers write all ColdFusion code in Tags. Some developers write all ColdFusion code in Script. Some write the view portions of their ColdFusion code in Tags and the business layer portion in Script. As long as you stay consistent, all approaches are valid. The overarching rule should be legibility and consistency.

Let's look at some statements and compare the differences:

View gist:4121052

In the first part of this hands on we are going to convert some pages to .cfm pages. We will then add some variables and output them to the user. Finally, we will add a comment to our code.

Tags Used: <cfset>, <cfoutput>

  1. Rename the /www/index.html file to index.cfm.
View gist:4121057

In this section of the hands on we will switch from tag based code to script based code and create a structure of data. We will then output that on the page.

Tags Used: <cfscript>, <cfoutput>

  1. Open up the /www/about.cfm file in your code editor.
You can’t perform that action at this time.