CF101: Welcome to ColdFusion - PowerPoint PPT Presentation

About This Presentation
Title:

CF101: Welcome to ColdFusion

Description:

CF101: Welcome to ColdFusion Simon Horwith CTO, Etrilogy Ltd. Who Am I? Macromedia Certified: Instructor Advanced ColdFusion Developer Flash Developer Member Team ... – PowerPoint PPT presentation

Number of Views:597
Avg rating:3.0/5.0
Slides: 28
Provided by: CharlesA158
Category:

less

Transcript and Presenter's Notes

Title: CF101: Welcome to ColdFusion


1
CF101 Welcome to ColdFusion
  • Simon Horwith
  • CTO, Etrilogy Ltd.

2
Who Am I?
  • Macromedia Certified
  • Instructor
  • Advanced ColdFusion Developer
  • Flash Developer
  • Member Team Macromedia
  • CTO, Etrilogy Ltd. (London)
  • Private Consultant Web/DB App Dev
  • Frequent CFUG and Conference Speaker
  • Monthly Contributor to CFDJ Magazine
  • Contributing Author of Several Books

3
Who Are You?
  • Web site developer
  • Looking to add more interactivity to your site
  • Web application developer or development manager
    whos heard of ColdFusion
  • Wondering how it works, how easy it is to use,
    how scalable it is for enterprise apps

4
What Well Cover
  • Well show
  • How easy it is to use and how it works
  • How CF can be used to add interactivity to your
    site
  • The basics of CF programming no previous CF
    experience required
  • How the features of CF make it an ideal platform
    solution for meeting complex business requirements

5
Topics
  • Introduction to ColdFusion
  • Code Basics
  • Database Integration
  • ColdFusion Features
  • QA

6
Introduction to ColdFusion
  • ColdFusion is
  • A leading Server-Side Web Application Development
    System
  • The leading rapid development platform for the
    web
  • Very easy to learn and to use
  • OS platform independent
  • A key part of Macromedias MX product line

7
Introduction to ColdFusion contd
  • On the web there are 2 classes of web
    technologies server-side and client-side
  • Client-side technologies run in a users browser
    Flash, JavaScript, Java Applets, etc.
  • Server-side runs on a central server
    ColdFusion, ASP, ASP.NET, Perl, PHP, etc.

8
Introduction to ColdFusion contd
  • Static Web Architecture user sends an HTTP
    request to a web server which then returns HTML
    (along with any client-side technology code) back
    to the browser for parsing
  • Dynamic Web Architecture user sends an HTTP
    request for a dynamic page to a web server. The
    web server routes the request to the Application
    Server which parses the server-side technology
    instructions and sends the resulting text back to
    the browser for parsing.

9
Introduction to ColdFusion contd
  • ColdFusion files have a .cfm extension
  • The web server hands any request for a .cfm page
    to the ColdFusion server for processing
  • The ColdFusion server looks through the contents
    of the page for instructions and ignores all
    other text (text, HTML, and other client-side
    technologies may be used in CF pages as the CF
    Server ignores them and they are sent back to the
    browser along with the dynamic page output)
  • ColdFusion Instructions are written in CFML

10
Code Basics
  • ColdFusion pages are written in CFML ColdFusion
    Mark-up Language
  • CFML is
  • Like HTML- it is a tag based language
  • Used to tell the ColdFusion server to connect
    with a database, create a variable, etc.
  • Processed in place. HTML and CFML are often
    interwoven in order to mark-up the output
    generated by CF tags

11
Code Basics contd
  • CFML tags begin with the letters CF
  • Two very common tags
  • ltCFSETgt creates a variable
  • ltCFOUTPUTgt displays a variable
  • Example
  • ltCFSET firstName Simongt
  • ltCFOUTPUTgt Variables.firstnamelt/CFOUTPUTgt

12
Code Basics contd
  • Variables in CF
  • Are case-insensitive
  • Are typeless
  • Exist for the duration of a request and are then
    destroyed
  • Have a prefix. A variable prefix tells
    ColdFusion where this variable exists in memory.
    ColdFusion will search for a variable in many
    memory scopes if no prefix is specified. This
    impacts on performance and readability.

13
Code Basics contd
  • ltCFOUTPUTgt
  • Has both an opening and closing tag
  • Tells ColdFusion to examine the text between the
    opening and closing tag and to evaluate any
    variable or expression surrounded with hash marks
    ()
  • Any non-CFML text inside ltCFOUTPUTgt is ignored,
    which

14
Code Basics contd
  • ltcfset fname Simongt
  • ltcfset lname Horwithgt
  • ltcfset fullname variables.fname
    variables.lnamegt
  • ltcfset email simon_at_horwith.comgt
  • ltcfoutputgt
  • Name ltbgtvariables.fullnamelt/bgtltbrgt
  • Email lta hrefmailtovariables.emailgtvariabl
    es.emaillt/agt
  • lt/cfoutputgt
  • Would display
  • Name Simon Horwith
  • Email simon_at_horwith.com

15
Code Basics contd
  • CFML comments are used to comment code and to
    prevent code from being parsed
  • Example
  • lt!--- this is a ColdFusion Comment ---gt

16
Code Basics contd
  • CFML not only has tags, but functions as well.
    There are over 70 tags and over 200 functions in
    the CFML language.
  • A few types of functions
  • Date manipulation/formatting
  • Array/structure manipulation
  • String manipulation
  • List manpulation
  • Mathematic operations
  • Etc.

17
Code Basics contd
  • Example of how to use functions to retrieve
    todays date (now() function) and display it in
    mm/dd/yy format (dateformat() function)
  • ltcfoutputgt
  • lt!--- display todays date in mm/dd/yy format
    ---gt
  • dateformat(now(),mm/dd/yy)
  • lt/cfoutputgt

18
Database Integration
  • CF can communicate with virtually any database,
    including
  • Microsoft SQL Server
  • Sybase
  • Oracle
  • DB/2
  • Informix
  • and many more enterprise DBMSs, as well as
    desktop DBMSs such as MS Access

19
Database Integration contd
  • ColdFusion MX uses Java Database Connectivity
    (JDBC) drivers to connect with databases
  • JDBC drivers translate SQL (Structured Query
    Language) commands to native binary code that a
    database understands, pass that binary code to a
    datasource for execution, and return any returned
    resultset to the ColdFusion page that invoked it.
  • A datasource is a named connection (alias) for
    a database it stores the database name,
    location, server name, login and password, etc.

20
Database Integration contd
  • ColdFusion passes SQL to a datasource using the
    ltCFQUERYgt tag
  • ltCFQUERYgt should always have
  • Name (assigns a name to the resultset and makes
    code more readable)
  • Datasource (the DataSource name that points at
    the database to pass the SQL to)
  • Example
  • ltCFQUERY nameqEmployees datasourcemyDSNgt
  • SELECT firstname, lastname
  • FROM employees
  • ORDER BY lastname
  • lt/CFQUERYgt

21
Database Integration contd
  • This code produces an ERROR!!
  • ltCFQUERY nameqEmployees datasourcemyDSNgt
  • SELECT firstname, lastname
  • FROM employees
  • ORDER BY lastname
  • lt/CFQUERYgt
  • ltcfoutputgt
  • firstname lastname
  • lt/cfoutputgt

22
Database Integration contd
  • This code displays only the first row from the
    recordset
  • ltCFQUERY nameqEmployees datasourcemyDSNgt
  • SELECT firstname, lastname
  • FROM employees
  • ORDER BY lastname
  • lt/CFQUERYgt
  • ltcfoutputgt
  • qEmployees.firstname qEmployees.lastname
  • lt/cfoutputgt

23
Database Integration contd
  • This code loops over each row from the recordset
    and displays itltCFQUERY nameqEmployees
    datasourcemyDSNgtSELECT firstname,
    lastnameFROM employeesORDER BY
    lastnamelt/CFQUERYgtltcfoutput queryqEmployeesgt
    qEmployees.firstname qEmployees.lastname
    ltbrgtlt/cfoutputgt

24
CF Features Yes it can do all this and SO much
more!
  • Tags and functions for creating, reading,
    renaming, moving, renaming, and deleting files
    and folders from the local file system
  • Easy access to LDAP (lightweight directory access
    protocol) resources
  • COM, DCOM, and CORBA support
  • Easy integration with existing Java Applications
  • HTTP functionality
  • Out of the box ease of establishing connections
    with MANY RDBMS platforms
  • Built-in security framework

25
CF Features contd
  • Advanced record-set functionality
  • Robust graphing and reporting functionality
  • Application architecture that supports persistent
    memory scopes
  • Over 70 tags and 200 functions built-in to the
    easy to use and learn CFML programming language
  • Custom Tags and User-Defined Functions
  • An object-oriented framework (ColdFusion
    Components) that offers OOP features and a layerr
    of abstraction between business logic and
    presentation

26
CF Features contd
  • Web services support for consumption and
    publication, ,including support for Java, .NET,
    and Flash Remoting Applications
  • XML support
  • Web based Administrative interface
  • Platform independent runs as a standalone
    server or J2EE application on many platforms.
  • Many online and printed resources
  • SO MUCH MORE!

27
Good Luck!
  • And enjoy ColdFusion!
  • Q A time
Write a Comment
User Comments (0)
About PowerShow.com