100% found this document useful (2 votes)
1K views

Introduction To ColdFusion

ColdFusion is a server-side scripting language that provides rapid application development features. It includes built-in capabilities for charting, searching, PDF generation, and connectivity to databases, LDAP directories, and other data sources. ColdFusion uses CFML (ColdFusion Markup Language) for its tag-based syntax. The upcoming version, ColdFusion 8, will add additional features for image manipulation, JSON serialization, and improved Ajax support.

Uploaded by

Ryan Stille
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
1K views

Introduction To ColdFusion

ColdFusion is a server-side scripting language that provides rapid application development features. It includes built-in capabilities for charting, searching, PDF generation, and connectivity to databases, LDAP directories, and other data sources. ColdFusion uses CFML (ColdFusion Markup Language) for its tag-based syntax. The upcoming version, ColdFusion 8, will add additional features for image manipulation, JSON serialization, and improved Ajax support.

Uploaded by

Ryan Stille
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Introduction to

ColdFusion
Ryan Stille
CF Web Tools
[email protected]
http://ryan.cfwebtools.com

http://creativecommons.org/licenses/by-sa/3.0/us/
Agenda
● What is ColdFusion
● Who uses ColdFusion
● Why would we want to use it / Features
● What I didn't cover
● The next version
● Resources
What is ColdFusion?
● Server side scripting language (CFML)
● The Adobe ColdFusion CFML engine
● The ColdFusion server is written in Java
● The language is tag based
● Runs on Windows, Linux, Unix, OSX
Who Uses ColdFusion?
● Everyone
● Some local companies include
– Union Pacific – Swanson Russell &
– Werner Trucking associates
– Mutual of Omaha
– Grace University
– NP Dodge
– Omaha Schools
– DTN
– Sergeants Pet Care
– National Equity
– Elisa Ilana
Where did it come from?
● Originally created by Allaire in 1995
● Allaire was bought by Macromedia in 2001
● Macromedia was bought by Adobe in 2005
● First version was extremely basic, but the later
versions are very powerful
● Version 6 (2002) was a complete rewrite – from
6.0 onward ColdFusion was written completely
in Java.
● Now on version 7.02. Ver. 8 is due mid 2007.
Why Use ColdFusion?
● Rapid Application Development
Why Use ColdFusion?
● Rapid Application Development
● Built in features
– Charting Engine
– Indexing and Searching
– PDF Generation
– Reporting Tool
– XML and XSLT
– Can talk to LDAP, POP, HTTP(s), FTP
– Task scheduling
Why Use ColdFusion?
● Built in features (cont.)
– GUI widgets such as a data grid
– Exception handling
– Session management
– Detailed debugging
– Remote Development Service
– Access to Java classes and methods
– IDE Support
– Can talk to any database that has a JDBC driver
ColdFusion Markup Language
<cfif expression>
<b>do stuff here</b>
<cfelse>
<i>else do this</i>
</cfif>
<cfscript>
function isUpperCase(character) {
if (Asc(character) gte 65 and Asc(character) lte 90)
return true;
return false;
}
</cfscript>
<cfscript>
// use Java to get hostname from an IP
function GetHostAddress(host) {
var iaddrClass = '';
var address = '';
iaddrClass = CreateObject("java", "java.net.InetAddress");
address = iaddrClass.getByName(host);
return address.getHostAddress();
}
</cfscript>
Queries are easy and clean
<cfquery name=”getUser” datasource=”MyDSN”>
SELECT fname, lname FROM users
WHERE userid = #URL.userid#
</cfquery>

<cfoutput>
Hello #getUser.fname# #getUser.lname# !
</cfoutput>
Use cfqueryparam to prevent SQL injection
<cfquery name=”getUser” datasource=”MyDSN”>
SELECT fname, lname FROM users
WHERE userid =
<cfqueryparam value=”#URL.userid#”
cfsqltype=”CF_SQL_INTEGER”>
</cfquery>

<cfoutput>
Hello #getUser.fname# #getUser.lname# !
</cfoutput>
Charting
<cfquery name="qryScores" datasource="MyDSN">
SELECT Student_ID, FinalTotal FROM Scores
</cfquery>

<cfchart format="jpg" show3d=”Yes” chartheight="400"


chartwidth="600">
<cfchartseries query="qryScores" itemcolumn="Student_ID"
valuecolumn="FinalScore" type="bar">
</cfchart>
Charting - Result
Searching Capabilities
● A version of the Verity K2 indexing/searching
server is bundled with ColdFusion
– scalable search engine based on a TCP/IP client-
server architecture
– Supports clustering
– Can populate from database
– File based indexing (spydering)
● Lucene
Verity – populating a collection
<cfquery name="qryContent" datasource="MyDSN">
SELECT id, articleContent, articleTitle FROM articles
</cfquery>

<cfindex collection="articleSearch" action="refresh"


query="qryContent" type="custom" body="articleContent"
title="articleTitle" key="id">
Verity – searching a collection
<cfsearch
name = "searchResults" collection = "articleSearch"
type = "criteria" criteria = "#Form.searchstring#" >

<cfoutput query="searchResults">
Result #currentRow# -
<a href="getArticle.cfm?articleID=#key#">#title#</a>
</cfoutput>
PDF Generation

<cfdocument src="http://www.google.com" format="pdf" />


PDF Generation
<cfdocument format="pdf" filename=”/tmp/myPdf.pdf”>
<b>html here!</b>
<img src=”and_images_too.jpg”>
</cfdocument>
XML Support
<!--- fetch an RSS feed --->
<cfhttp
url="http://www.fullasagoog.com/xml/ColdFusionMX.xml"
method="GET" />

<!--- make an XML object out of the returned text --->


<cfset xmlDoc = XmlParse(cfhttp.fileContent)>

<!--- and take a look at it --->


<cfdump var="#xmlDoc#">
Other connectivity tags
● <cfldap>
● <cfpop>
● <cfhttp>
● <cfftp>
● <cfmail>
Query of a Query
<cfquery name=”qryUsers” datasource=”MyDSN”>
SELECT * FROM users
</cfquery>

<cfquery name=”QoQ” dbtype=”query”>


SELECT * FROM qryUsers WHERE state = 'NE'
</cfquery>
Query of a Query
<cfset OptData = StockData.getOptions(symbol = 'GE')>

<cfquery name=”QoQ” dbtype=”query”>


SELECT * FROM OptData WHERE
OptExpireDate =
'#OptData.OptExpireDate[OptData.RecordCount]#'
AND LastPrice <
#OptData.StockPrice[OptData.RecordCount]#
ORDER BY LastPrice
</cfquery>
Session Management
● ColdFusion has various variable scopes:
– <cfset myVar = “foo”> places myVar into the
“variables” scope.
– Other scopes:
● Form
● URL

● Request

● CGI

● Cookie
Session Management
● Persistent Scopes:
– Session – these variables are placed into memory
– Client – placed in the client variables database
– Application – can be seen only by code using the
same application
– Server – Can be seen by all applications on a
server
Task Scheduling
● CF Administrator Demonstration
Debugging Features
● Demo
Development in ColdFusion
● Developer edition is free
● IDEs
– Dreamweaver has CFML syntax support
– Homesite+
– CFEclipse
Development in ColdFusion
● MVC Code Frameworks
– Fusebox
– Model Glue
– Mach II
● ORM Frameworks (Object Relational Mapping)
– Transfer
– Reactor
Development in ColdFusion
● Dependency Injection
– ColdSpring
– LiteWire
● Unit Testing
– CfUnit
– CFCUnit
Development in ColdFusion
● Remote Development Service
– Allows you to connect to a ColdFusion server and
open/edit files on that machine
– Supported in HomeSite and CFEclipse
What I didn't cover
● OO (Components)
● Application.cfc / .cfm
● Flash/Flex Integration
● Gateways
● Reports
● Flash Forms
Whats coming in ColdFusion 8
● <cfimage> - image manipulation
● Sharpen, blur, crop, resize, rotate, etc.
● Also a full low-level drawing API that allows lines,
shapes, text, etc. to be overlaid on existing images.
● Serialize and deserialize JSON
● Ajax grids using <cfgrid>
● More Eclipse integration, including a real time
log viewer
● .NET Integration - CreatObject() can invoke
.NET objects. Even on non-windows platforms
Whats coming in ColdFusion 8
● <cfexchangeconnection> - integration with MS
Exchange
● <CFPDF> and <CFPDFForm>
– gets PDFmetadata, merge pdfs, extract pages,
encrypt, create a thumbnail page, flatten pdfs,
protect, execute ddx instruction sets.
● A lot of AJAX Stuff
– AJAX proxy allows you to call ColdFusion objects
and functions from within JavaScript
– AJAX data logging window
Whats coming in ColdFusion 8
● A lot of AJAX Stuff (cont.)
– Easy auto suggest:
● Statically: <cfinput type="text" name="breed"
autosuggest="Bengal,Birman,British
Shorthair,Burmese,Egyptian Mau,Exotic
Shorthair,Persian" >
● Ajaxified: <cfinput type="text" name="breed"
autosuggest="cfc:breeds.getList({cfautosuggestvalue})" >
● On demand presentations
● Scorpio is much faster than CF7
Whats coming in ColdFusion 8
● Threading!
– <cfthread action=” run | join | sleep | terminate” ...>
– Can get thread metadata (elapsed time, error,
name, output, priority, starttime, status.)
● New Server Monitoring/Administration tool
– View/kill active threads
– View executing pages, queries, etc. - sorted by
time, memory, etc.
– Can monitor multiple servers on one screen
– The API used for the server monitoring is public
Whats coming in ColdFusion 8
● Run PHP/Ruby etc from within CF ????
<cfset who = "Sean" />
<cf_php>
<?php
echo "Hello ".$_COLDFUSION["who"]."<br />";
$_COLDFUSION["greeting"] = "wibble";
?>
</cf_php>
<cfoutput>greeting = #greeting#</cfoutput>
Whats coming in ColdFusion 8
● How is this possible? ColdFusion 8 uses Java 6 which
provides access to the javax.script package and all the
J-language implementations available. Quercus is a
Java implementation of PHP and it is implemented as
a script engine.
Resources
● Nebraska ColdFusion Users Group - www.necfug.com
– Meets the 4th Tues of every month
– Many give-a-ways
– Special Speakers from Adobe and other companies
● ColdFusion Blog Aggregators
– http://www.fullasagoog.com
– http://weblogs.macromedia.com/mxna/
● Mailing Lists
– http://www.houseoffusion.com
● Many conferences around the country
– Adobe Max, CF United, CF.Objective
Resources (cont.)
● Podcasts
– ColdFusion Weekly - www.coldfusionweekly.com
– Out Loud - www.helmsandpeters.com
– The ColdFusion Podcast - www.coldfusionpodcast.com
– ColdFusion Muse - www.coldfusionmuse.com
● Developer Edition is free - www.adobe.com/coldfusion
● ColdFusion 8 Beta -
http://labs.adobe.com/technologies/coldfusion8/
● Free CF8 Hosting - http://www.hostmysite.com/cf8
THE END

You might also like