-
CFML Language Reference ColdFusion 4.
-
Copyright Notice © 1999 Allaire Corporation. All rights reserved. This manual, as well as the software described in it, is furnished under license and may be used or copied only in accordance with the terms of such license. The content of this manual is furnished for informational use only, is subject to change without notice, and should not be construed as a commitment by Allaire Corporation.
-
Contents Preface: Welcome To ColdFusion ................................................................xiii Intended Audience.........................................................................................................................xiv Welcome to the ColdFusion 4.5 Web Application Server ...........................................................xiv Products and System Requirements ............................................................................................
-
iv CFML Language Reference Flow-Control Tags ............................................................................................................................7 Internet Protocol Tags ......................................................................................................................7 Java Servlet and Java Object Tags ....................................................................................................8 Variable Manipulation Tags..................................
-
Contents CFHEADER ......................................................................................................................................90 CFHTMLHEAD................................................................................................................................91 CFHTTP ...........................................................................................................................................92 CFHTTPPARAM ......................................................
-
vi CFML Language Reference Arrays......................................................................................................................................197 Dynamic variable names ......................................................................................................197 COM objects ..........................................................................................................................197 CFSETTING ..............................................................
-
Contents ArrayResize ....................................................................................................................................268 ArraySet..........................................................................................................................................269 ArraySort........................................................................................................................................270 ArraySum ..............................................
-
viii CFML Language Reference DaysInMonth ................................................................................................................................333 DaysInYear ....................................................................................................................................334 DE...................................................................................................................................................335 DecimalFormat .......................
-
Contents IsBoolean .......................................................................................................................................391 IsDate .............................................................................................................................................392 IsDebugMode................................................................................................................................393 IsDefined ................................................
-
x CFML Language Reference LSParseNumber ............................................................................................................................460 LSTimeFormat ..............................................................................................................................461 LTrim..............................................................................................................................................463 Max.............................................
-
Contents StripCR...........................................................................................................................................521 StructClear.....................................................................................................................................522 StructCopy.....................................................................................................................................523 StructCount .............................................
-
xii CFML Language Reference Notes on using variables.......................................................................................................575 Operators .......................................................................................................................................576 Arithmetic operators .............................................................................................................576 String operators ...................................................
-
Preface Welcome To ColdFusion ColdFusion is a rapid application development system for professional developers who want to create dynamic Web applications and interactive Web sites. It provides the fastest way to integrate browser, server, and database technologies into powerful Web applications. With ColdFusion, you can build everything from online stores to sophisticated business systems.
-
xiv CFML Language Reference Intended Audience This reference is intended for web developers who have a working knowledge of ColdFusion; that is, you know how to use tags and functions, but you need a comprehensive reference that provides an in-depth description of each tag and function, and examples of how tags and functions are used in the context of an HTML/ CFML page. Welcome to the ColdFusion 4.5 Web Application Server The ColdFusion 4.
-
Preface xv • 128 MB RAM (256 MB recommended for clustering) ColdFusion Server 4.5 Enterprise Edition for Solaris • SPARC Solaris 2.5.1, 2.6, or 7 (patch 103582-1B or higher) • 128 MB RAM (256 MB recommended for clustering) • 200 MB hard disk space ColdFusion Server 4.5 Enterprise Edition for Linux • Red Hat Linux 6.0 or 6.1 • Intel Pentium or above • 128 MB RAM (256 MB recommended for clustering) • 150 MB hard disk space ColdFusion Server 4.
-
xvi CFML Language Reference New visual tools Universal File Browser — Access all your files from a single explorer that integrates access to the Windows file system, ColdFusion RDS servers, and FTP servers. Dragand-drop between any of these services all in an integrated file browser.
-
Preface xvii Improved Automatic Server Recovery — Monitor and automatically restart server process in case of failures or critical errors on individual servers not deployed in a cluster. Clustering Support for Apache — Setup ColdFusion clusters on Linux and Solaris using the Apache Web Server. (Enterprise Edition only) Automatic Shared Variable Locking — Lock user and session variable reads automatically at the server level to prevent destabilizing conflicts and control thread write contentions.
-
xviii CFML Language Reference Java-based ColdFusion Extensions (CFX) — Extend ColdFusion with new functionality through CFXs created with Java. Binary Object Support — Use Character Large Binary Object (CLOB) support to encoded binary objects, transmit them via XML, and store them in databases or files. SQL Bind Parameters — Improve query performance, security and flexibility with explicitly typed query parameters. WDDX 1.
-
Preface xix Language Reference Features The CFML Language Reference provides descriptions, syntax, usage, and code examples for: • CFML Tags • CFML Functions • JavaScript objects used when implementing web distributed data exchange (WDDX) The CFML Language Reference also provides a chapter on expressions, operators, and other CFML constructs. Using Examples Each tag and function features a runnable example, using code drawn from the snippets directory (found in webroot\cfdocs\snippets).
-
xx CFML Language Reference Using End Tags Except where noted in the syntax, CFML tags do not require an end tag. However, all CFML tags (except CFELSE and CFELSEIF) can accept an optional end tag, as follows: • Shorthand — You can use shorthand notation to include the end tag with the base tag. For example: • Explicit specification — You can specify an end tag explicitly. However, there can be no white space between the start and end tags.
-
Preface xxi About ColdFusion Documentation ColdFusion documentation is designed to provide support for all components of the ColdFusion development system. Both the print and online versions are organized to allow you to quickly locate the information you need. In addition to the book set, the documentation is provided in two other formats: • HTML — Browser-based Help references.
-
xxii CFML Language Reference Using ColdFusion Studio Documents everything you need to know about using ColdFusion Studio, including features like projects, source control integration, as well as the Studio workspace and interface. ColdFusion Quick Reference Guide A valuable quick reference to CFML tags, functions, and variables. ColdFusion Server online documentation To view the HTML documentation, open the following URL: http://127.0.0.1/ cfdocs/dochome.htm.
-
Preface xxiii Documentation conventions When reading, please be aware of these formatting cues: • Code samples, filenames, and URLs are set in a monospaced font • Notes and tips are identified by bold type • Bulleted lists present options and features • Numbered steps indicate procedures • Tool button icons are generally shown with procedure steps • Menu levels are separated by the greater than (>) sign • Text for you to type in is set in italics Getting Answers One of the best ways to solve particular p
-
xxiv CFML Language Reference Technical support Telephone support is available Monday through Friday 8 A.M. to 8 P.M. Eastern time (except holidays) Toll Free: 888.939.2545 (U.S. and Canada) Tel: 617.761.2100 (outside U.S. and Canada) For complete details about Allaire Product Support options, please refer to the Allaire Support pages on the Allaire web site: http://www.allaire.com/support. Postings to the ColdFusion Support Forum (http://forums.allaire.com) can be made any time. Sales Toll Free: 888.939.
-
CHAPTER 1 Chapter 1 ColdFusion Tags This chapter describes each of the tags in the ColdFusion Markup Language (CFML). The introduction contains an alphabetical summary of ColdFusion tags, a list of new tags in ColdFusion 4.5, and a list of tags by category. The remainder of this chapter provides complete descriptions of each tag, listed alphabetically. Contents • Alphabetical List of ColdFusion Tags................................................................ 2 • New Tags in ColdFusion 4.5........
-
2 CFML Language Reference Alphabetical List of ColdFusion Tags The ColdFusion Markup Language (CFML) consists of a set of tags you use in your ColdFusion pages to interact with data sources, manipulate data, and display output. Using CFML tags is very simple; tag syntax is much like HTML element syntax. The following table provides brief descriptions of each CFML tag. CFML Tag Summary CFML Tag Description CFABORT Stops processing of a ColdFusion page at the tag location.
-
Chapter 1: ColdFusion Tags 3 CFML Tag Summary (Continued) CFML Tag Description CFFORM Builds an input form and performs client-side input validation. CFFTP Permits FTP file operations. CFGRID Used in CFFORM to create a grid control for tabular data. CFGRIDCOLUMN Used in CFFORM to define the columns used in a CFGRID. CFGRIDROW Used with CFGRID to define a grid row. CFGRIDUPDATE Performs updates directly to ODBC data source from edited grid data. CFHEADER Generates HTTP headers.
-
4 CFML Language Reference CFML Tag Summary (Continued) CFML Tag Description CFMAILPARAM Attaches a file or adds a header to an email message. CFMODULE Invokes a custom tag for use in your ColdFusion application pages. CFOBJECT Creates and uses COM, CORBA, or JAVA objects. CFOUTPUT Displays output of database query or other operation. CFPARAM Defines a parameter and its initial default value. CFPOP Retrieves messages from a POP mail server.
-
Chapter 1: ColdFusion Tags 5 CFML Tag Summary (Continued) CFML Tag Description CFSILENT Suppresses all output that is produced by the CFML within the tag’s scope. CFSLIDER Used in CFFORM to create a slider control element. CFSTOREDPROC Specifies database connection information and identifies the stored procedure to be executed. CFSWITCH/CFCASE/CFDEFAULTCASE Evaluates a passed expression and passes control to the CFCASE tag that matches the expression result. CFTABLE Builds a table.
-
6 CFML Language Reference ColdFusion Forms Tags CFAPPLET CFINPUT CFFORM CFSELECT CFGRID CFSLIDER CFGRIDCOLUMN CFTEXTINPUT CFGRIDROW CFTREE CFGRIDUPDATE CFTREEITEM Database Manipulation Tags CFINSERT CFQUERYPARAM CFPROCPARAM CFSTOREDPROC CFPROCRESULT CFTRANSACTION CFQUERY CFUPDATE Data Output Tags CFCOL CFOUTPUT CFCONTENT CFTABLE CFHEADER Exception Handling Tags CFERROR CFRETHROW CFTHROW CFTRY/CFCATCH
-
Chapter 1: ColdFusion Tags 7 Extensibility Tags CFCOLLECTION CFSEARCH CFEXECUTE CFSERVLET CFINDEX CFSERVLETPARAM CFOBJECT CFWDDX CFREPORT File Management Tags CFDIRECTORY CFFILE Flow-Control Tags CFABORT CFLOOP CFBREAK CFSWITCH/CFCASE/CFDEFAULTCASE CFEXECUTE CFTHROW CFIF/CFELSEIF/CFELSE CFTRY/CFCATCH CFLOCATION Internet Protocol Tags CFFTP CFMAIL CFHTTP CFMAILPARAM CFHTTPPARAM CFPOP CFLDAP
-
8 CFML Language Reference Java Servlet and Java Object Tags CFOBJECT CFSERVLETPARAM CFSERVLET Variable Manipulation Tags CFCOOKIE CFSCRIPT CFPARAM CFSET Web Application Framework Tags CFAPPLICATION CFERROR CFASSOCIATE CFLOCK CFAUTHENTICATE Other Tags CFASSOCIATE CFREPORT CFCACHE CFSETTING CFHTMLHEAD CFSILENT CFINCLUDE CFWDDX CFLOCK
-
Chapter 1: ColdFusion Tags 9 CFABORT The CFABORT tag stops processing of a page at the tag location. ColdFusion simply returns everything that was processed before the CFABORT tag. CFABORT is often used with conditional logic to stop processing a page because of a particular condition. Syntax SHOWERROR Optional. Specify the error you want to display when CFABORT executes. This error message appears in the standard ColdFusion error page.
-
10 CFML Language Reference
The value of myVariable after incrementing through the loop #Counter# times is: #myVariable#
Example B: Use CFABORT to halt the instruction
#CFCATCH.message#
...
-
Chapter 1: ColdFusion Tags 19 CFBREAK Used to break out of a CFLOOP. See Breaking out of a loop, later in this chapter, for more information.
-
20 CFML Language Reference CFCACHE CFCACHE allows you to speed up pages considerably in cases where the dynamic content doesn’t need to be retrieved each time a user accesses the page. To accomplish this, it creates temporary files that contain the static HTML returned from a particular run of the ColdFusion page. You can use CFCACHE for simple URLs and URLs that contain URL parameters.
-
Chapter 1: ColdFusion Tags 21 CACHEDIRECTORY Optional. Specifies the fully qualified path of the directory where the pages are to be cached. The default is the directory of the current page. EXPIREURL Optional. Used with ACTION=FLUSH. EXPIREURL takes a wildcarded URL reference that ColdFusion matches against all mappings in the cfcache.map file. The default is to flush all mappings. For example, "foo.cfm" matches "foo.cfm"; "foo.cfm?*" matches "foo.cfm?x=5" and "foo.cfm?x=9". PORT Optional.
-
22 CFML Language Reference You can refresh the cache in the following ways: • TIMEOUT attribute — ColdFusion tests the timestamp of the cached file against the TIMEOUT attribute. If the cached file’s timestamp is older than TIMEOUT, the old file is deleted and a new one created. You can use fixed dates if necessary, but it's preferable to use relative dates. This is the preferred technique and it works for seconds, hours, days, weeks, years, etc.
-
Chapter 1: ColdFusion Tags 23 CFCOL Defines table column header, width, alignment, and text. Only used inside a CFTABLE. Syntax HEADER The text to use for the column’s header. WIDTH The width of the column in characters (the default is 20). If the length of the data displayed exceeds the width value, the data is truncated to fit. ALIGN Column alignment, Left, Right, or Center.
-
24 CFML Language Reference as well as specifying the header information and the text/CFML with which to fill the cell --->