beautypg.com

Chapter 19: server formats, How data formatting works, The formats.xml file – Adobe Extending Dreamweaver CS4 User Manual

Page 309

background image

303

Chapter 19: Server formats

Data sources

” on page 290 discusses how Adobe Dreamweaver inserts dynamic data into a user document by adding

a server expression at the appropriate location. When a visitor requests the document from the web server, that server
expression is converted to a value from a database, the contents of a request variable, or some other dynamic value.
The Dreamweaver server formats let you format how this dynamic value is presented to the visitor.

How data formatting works

Dreamweaver users can format data with built-in formats. They can also create new formats that are based on built-in
format types, or create new formats that are based on custom format types.

The user can format dynamic data in several ways. To format the data before inserting it into an HTML document, use
the Format menu. It is in the Dynamic Data or the Dynamic Text dialog box or in the Bindings panel. To create a
format, select the Edit Format List command from the Format menu and select a format type from the Plus (+) menu.
The Plus (+) menu contains a list of format types. Format types are basic format categories, such as Currency,
DateTime, or AlphaCase. Format types collect all the common parameters for a category of format, letting you
streamline the work to create a format.

An example is to create a currency format. Currency formatting consists of converting a number to a string, inserting
commas and decimal points, and inserting a currency symbol, such as a dollar ($) sign. The Currency format data type
collects all the common parameters and prompts you for the required values.

The server format API discusses the API that formats the dynamic data that the functions described in

Data sources

on page 290 return. The functions that are described in both topics work together to format dynamic data.

All format files reside in the Configuration/ServerFormats/currentServerModel folder. Each subfolder contains one
XML file and multiple HTML files.

The Formats.xml file describes all the choices in the Format menu. Dreamweaver automatically adds the Edit Format
List and None options.

The folder also contains one HTML file for each currently installed format type, which includes

AlphaCase

,

Currency

,

DateTime

,

Math

,

Number

,

Percent

,

Simple

, and

Trim

.

Note: Currency format is not available for PHP server models.

The Formats.xml file

The Formats.xml file contains one

format

tag for each item in the Format menu. Each

format

tag contains the

following mandatory attributes:

The

file=fileName

attribute is the HTML file for this format type, such as

"Currency"

.

The

title=string

attribute is the string that appears in the Format menu, such as

"Currency - default"

.

This manual is related to the following products: