Detailed instructions for use are in the User's Guide.
[. . . ] COLDFUSION MX 7
®
CFML Reference
Trademarks 1 Step RoboPDF, ActiveEdit, ActiveTest, Authorware, Blue Sky Software, Blue Sky, Breeze, Breezo, Captivate, Central, ColdFusion, Contribute, Database Explorer, Director, Dreamweaver, Fireworks, Flash, FlashCast, FlashHelp, Flash Lite, FlashPaper, Flex, Flex Builder, Fontographer, FreeHand, Generator, HomeSite, JRun, MacRecorder, Macromedia, MXML, RoboEngine, RoboHelp, RoboInfo, RoboPDF, Roundtrip, Roundtrip HTML, Shockwave, SoundEdit, Studio MX, UltraDev, and WebHelp are either registered trademarks or trademarks of Macromedia, Inc. and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, service marks, or trade names of Macromedia, Inc. or other entities and may be registered in certain jurisdictions including internationally. [. . . ] This tag selects the matching alternative from the cfcase and cfdefaultcase tags, jumps to the matching tag, and executes the code between the cfcase start and end tags. The cfswitch tag provides better performance than a series of cfif/cfelseif tags, and the code is easier to read.
cfswitch
407
Example <!--- This example shows the use of cfswitch and cfcase to exercise a case statement in CFML. ---> <cfquery name = "GetEmployees" dataSource = "cfdocexamples"> SELECT Emp_ID, FirstName, LastName, EMail, Phone, Department FROM Employees </cfquery> <h3>cfswitch Example</h3> <!--- By outputting the query and using cfswitch, we classify the output without using a cfloop construct. ---> <p>Each time the case is fulfilled, the specific information is printed; if the case is not fulfilled, the default case is output </p> <cfoutput query="GetEmployees"> <cfswitch expression="#Trim(Department)#"> <cfcase value="Sales"> #FirstName# #LastName# is in <b>sales</b><br><br> </cfcase> <cfcase value="Accounting"> #FirstName# #LastName# is in <b>accounting</b><br><br> </cfcase> <cfcase value="Administration"> #FirstName# #LastName# is in <b>administration</b><br><br> </cfcase> <cfdefaultcase> #FirstName# #LastName# is not in Sales, Accounting, or Administration. <br><br> </cfdefaultcase> </cfswitch> </cfoutput>
408
Chapter 2: ColdFusion Tags
cftable
Description
Builds a table in a ColdFusion page. This tag renders data as preformatted text, or, with the HTMLTable attribute, in an HTML table. If you don't want to write HTML table tag code, or if your data can be presented as preformatted text, use this tag. Preformatted text (defined in HTML with the <pre> and </pre> tags) displays text in a fixedwidth font. It displays white space and line breaks exactly as they are written within the pre tags. To define table column and row characteristics, use the cfcol tag within this tag.
Category
Data output tags
Syntax <cftable query = "query_name" maxRows = "maxrows_table" colSpacing = "number_of_spaces" headerLines = "number_of_lines" HTMLTable border colHeaders startRow = "row_number"> . . . </cftable> See also cfcol, cfcontent, cflog, cfoutput, cfprocessingdirective, cftable;
"Retrieving data" in Chapter 20, "Accessing and Retrieving Data, " in ColdFusion MX Developer's Guide
Attributes Attribute query maxRows colSpacing headerLines HTMLTable Req/Opt Default Description Required Optional Optional Optional Optional 2 2 Name of cfquery from which to draw data. Number of lines to use for table header (the default leaves one line between header and first row of table). If you use this attribute (regardless of its value), ColdFusion renders data in an HTML table. If you use this attribute (regardless of its value), ColdFusion displays a border around the table. Use this only if you use the HTMLTable attribute.
border
Optional
cftable
409
Attribute colHeaders
Req/Opt Default Description Optional Displays column heads. If you use this attribute, you must also use the cfcol tag header attribute to define them. If you use this attribute (regardless of its value), ColdFusion displays column heads. 1 The query result row to put in the first table row.
startRow Usage
Optional
This tag aligns table data, sets column widths, and defines column heads. To display the cfcol header text, you must specify the cfcol header and the cftable colHeader attribute. If you specify either attribute without the other, the header does not display and no error is thrown.
Example <!--- This example shows the use of cfcol and cftable to align information returned from a query. ---> <!--- This query selects employee information from cfdocexamples datasource. ---> <cfquery name = "GetEmployees" dataSource = "cfdocexamples"> SELECT Emp_ID, FirstName, LastName, EMail, Phone, Department FROM Employees </cfquery> <html> <body> <h3>cftable Example</h3> <!--- Note use of HTMLTable attribute to display cftable as an HTML table, rather than as PRE formatted information. ---> <cftable query = "GetEmployees" startRow = "1" colSpacing = "3" HTMLTable> <!--- Each cfcol tag sets width of a column in table, and specifies header information and text/CFML with which to fill cell. [. . . ] · post: sends information to the server page or CGI program for processing. Required The absolute URL of the host name or IP address of the server on which the file resides. When required by a server, a password.
url
username password
1104
Chapter 10: ColdFusion ActionScript Functions
Arguments resolveurl
Req/Opt Description Optional For Get and Post methods. For GET and POST operations, if Yes, the page reference that is returned into the Filecontent property has its internal URLs fully resolved, including port number, so that links remain intact. [. . . ]