23.08.2013 Views

ColdFusion Developer's Guide - Electromanuals.org

ColdFusion Developer's Guide - Electromanuals.org

ColdFusion Developer's Guide - Electromanuals.org

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Ofrecido por www.electromanuales.com<br />

ADOBE COLDFUSION 8<br />

<strong>ColdFusion</strong> Developer’s <strong>Guide</strong><br />

User-defined functions let you encapsulate logic and operations that you use frequently in a single unit. This way,<br />

you can write the code once and use it multiple times. UDFs ensure consistency of coding and enable you to structure<br />

your CFML more efficiently.<br />

Typical user-defined functions include mathematical routines, such as a function to calculate the logarithm of a<br />

number; string manipulation routines, such as a function to convert a numeric monetary value to a string such as<br />

“two dollars and three cents”; and can even include encryption and decryption routines.<br />

Note: The Common Function Library Project at www.cflib.<strong>org</strong> includes a number of free libraries of user-defined<br />

functions.<br />

For more information on user-defined functions, see “Writing and Calling User-Defined Functions” on page 134.<br />

<strong>ColdFusion</strong> components<br />

<strong>ColdFusion</strong> components encapsulate multiple, related, functions. A <strong>ColdFusion</strong> component is essentially a set of<br />

related user-defined functions and variables, with additional functionality to provide and control access to the<br />

component contents. <strong>ColdFusion</strong> components can make their data private, so that it is available to all functions (also<br />

called methods) in the component, but not to any application that uses the component.<br />

<strong>ColdFusion</strong> components have the following features:<br />

• They are designed to provide related services in a single unit.<br />

• They can provide web services and make them available over the Internet.<br />

• They can provide <strong>ColdFusion</strong> services that Flash clients can call directly.<br />

• They have several features that are familiar to object-oriented programmers, including data hiding, inheritance,<br />

packages, and introspection.<br />

For more information on <strong>ColdFusion</strong> components, see “Building and Using <strong>ColdFusion</strong> Components” on page 158.<br />

Constants<br />

The value of a constant does not change during program execution. Constants are simple scalar values that you can<br />

use within expressions and functions, such as “Robert Trent Jones” and 123.45. Constants can be integers, real<br />

numbers, time and date values, Boolean values, or text strings. <strong>ColdFusion</strong> does not allow you to give names to<br />

constants.<br />

Variables<br />

Variables are the most frequently used operands in <strong>ColdFusion</strong> expressions. Variable values can be set and reset, and<br />

can be passed as attributes to CFML tags. Variables can be passed as parameters to functions, and can replace most<br />

constants.<br />

<strong>ColdFusion</strong> has a number of built-in variables that provide information about the server and are returned by<br />

<strong>ColdFusion</strong> tags. For a list of the <strong>ColdFusion</strong> built-in variables, see “Reserved Words and Variables” on page 2 in the<br />

CFML Reference.<br />

15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!