Lesson 3. Variables and Functions

I l @ ve RuBoard

Lesson 3. Variables and Functions

When you develop a Web site with ColdFusion, two of the most important tools that you will use are variables and functions. You will probably spend more time on tasks that involve working with variables and functions than with any other features (other than database interactivity).

Variables are what you use when you want to store information to use later. Think of them as containers that hold a piece of information, such as a name, a date, or a price. When you want to use the piece of information, you take it out of the container. The variable, or container, has a specific name, and when you want to use the information in the variable you reference it by that name .

You will be using functions and variables in just about every ColdFusion page you build. The ones used in this example are the now() and dateformat() functions as well as a simple variable.

Functions offer a wide variety of built-in abilities that can affect your templates in numerous ways. Each function performs a specific task and has an expected result. Many functions are built in to the ColdFusion Server, although you can also create your own.

In this lesson and the following lessons, we'll work on tasks related to the design, use, and maintenance of a Web site for a fictitious company called The Wireless Agent. Some of the activities will be related to the user experience, and some to the administrator; all involve using ColdFusion to handle different tasks. For users, you will set up functions that allow them to search for products and display the results of their search, as well as display details about those products. For administrators, you will create pages that allow them to add, update, and delete products from the site, keeping the product information fresh and up to date.

WHAT YOU WILL LEARN

In this lesson, you will:

  • Learn what variables and functions are

  • Create and display a date variable

  • Pass a date variable between two templates

  • Use a function to format a date

APPROXIMATE TIME

This lesson takes approximately 1 hour to complete.

LESSON FILES

Starting Files:

Lesson3\Start\date.cfm

Lesson3\Start\dateformat.cfm

Completed Files:

Lesson3\Complete\date.cfm

Lesson3\Complete\dateformat.cfm

I l @ ve RuBoard


Macromedia ColdFusion 5. Training from the Source
Macromedia ColdFusion 5 Training from the Source (With CD-ROM)
ISBN: 0201758474
EAN: 2147483647
Year: 2002
Pages: 99
Authors: Kevin Schmidt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net