12:16:01 AM
Thursday
Sep 09
Su M Tu W Th F Sa
567891011
12131415161718
19202122232425
262728293012
3456789

Play My Typing Game

View Some of My Artwork

Beginning Coldfusion
Coldfusion is a server side, similar to that of PHP or ASP/.NET. Coldfusion is unique in the sense that Coldfusion MX 7 code is compiled into Java bytecode. Currently owned by Adobe, you typically will only find coldfusion running on windows servers.

The syntax of programming in Coldfusion Markup Language (CFML) is similar to HTML or XML. You will need to name your files with a .cfm extension, and the webserver will interpret the page and perform any coldfusion necessary before outputting the HTML or other text naturally sent to the browser.

Lets echo out some output. We use the cfoutput tag.

<cfoutput>Hello World</cfoutput>


Coldfusion is weakly typed, meaning that you do not have to specify the data type per variable. CF determines the data type of a variable at the time the variable is used. A common way to set variables is using the cfset tag.

<cfset name = "Adam" />
<cfset somenumber = 10 />


In ColdFusion, variable names consist of letters, digits, underscores and dollar signs. Variable names are case insensitive. Variable names cannot begin with a digit.

There are different kinds of variable scope.
Variable Scope
ScopePrefixDescription
LocalVARIABLESDefined and accessible on the current page only.
CGICGIAccessible on any page. Contains server environment variables.
URLURLAccessible on the current page. Contains values passed in on the query string.
FormFORMAccessible on the current page. Contains values passed in through a form.
CookieCOOKIEAccessible on any page. Contains variables held in cookies on the client machine.
ClientCLIENTAccessible on any page. Contains variables created using the Client prefix.
ArgumentsARGUMENTSDefined and accessible within a user-defined function or a ColdFusion Component method.
SessionSESSIONPrefix Required. Accessible on any page to a single user for the duration of a client session.
ApplicationAPPLICATIONPrefix Required. Accessible on any page to all users until the application is restarted.
ServerSERVERPrefix Required. Accessible on any page that is delivered from specific server.


ColdFusion will search through the scopes in the following order:
  1. Arguments
  2. Local (Variables)
  3. CGI
  4. URL
  5. Form
  6. Cookie
  7. Client


We used the cfoutput tag earlier to output text. We encapsulate variable names in pound signs (#) to output a variable using the cfoutput tag.

<cfset str = "Hello" />
<html>
<body>
<cfoutput>#VARIABLES.str# World!</cfoutput>
</body>
</html>





Read Previous:
How to select an item in a combo box with script
Table of Contents


Give a listen to my music...
My Best Recordings
How my services and skills can help you:
  • Global (via Email/Skype/AIM(ichat)/Yahoo)
    • Web Development Consulting
    • Custom Web App Development (PHP/MySQL/jQuery/CSS) Cross-Browser & OS
    • Cellphone App Development (Android/MobileWeb)
    • Music Lessons & Education for Beginner Guitar, Piano, Bass, which transfers over to many other instruments I am comfortable playing but not yet at teaching.
    • Music - Soundtrack Composition & Voice Work
  • Local
    • Most all the above, but also:
      • Music Performance (Harp, Voice, Guitar, Piano, Bass, Latin Percussion)
      • Recording Live Music Audio
      • Video Streaming live music and other live events anywhere that can provide wifi
      • Training Video Streaming to your venue's trusted soundperson
Skills:
  • Global (via Email/Skype/AIM(ichat)/Yahoo)
    • Web Development Consulting
    • Custom Web App Development (PHP/MySQL/jQuery/CSS) Cross-Browser & OS
    • Cellphone App Development (Android/MobileWeb)
    • Music Lessons & Education for Beginner Guitar, Piano, Bass, which transfers over to many other instruments I am comfortable playing but not yet at teaching.
    • Music - Soundtrack Composition & Voice Work
  • Local, Most all the above, but also:
    • Music Performance (Harp, Voice, Guitar, Piano, Bass, Latin Percussion)
    • Being your venue's soundman
    • Video Streaming live music and other live events anywhere that can provide wifi
    • Training Video Streaming to your venue's trusted soundperson