150
CFML Language Reference
Example
<!--- This example shows how CFOUTPUT operates --->
<!--- run a sample query --->
<CFQUERY NAME="GetCourses" DATASOURCE="cfsnippets">
SELECT Dept_ID, CorName, CorLevel
FROM courseList
ORDER by Dept_ID, CorLevel, CorName
</CFQUERY>
<HTML>
<HEAD>
<TITLE>CFOUTPUT</TITLE>
</HEAD>
<BODY>
<H3>CFOUTPUT Example</H3>
<P>CFOUTPUT simply tells ColdFusion Server
to begin processing, and then to hand back control
of page rendering to the web server.
<P>For example, to show today’s date, you could write
#DateFormat("#Now()#"). If you enclosed that expression
in CFOUTPUT, the result would be <CFOUTPUT>#DateFormat(Now())#
</CFOUTPUT>.
<P>In addition, CFOUTPUT may be used to show the results of
a query operation, or only a partial result, as shown:
<P>There are <CFOUTPUT>#getCourses.recordCount#</CFOUTPUT> total records
in our query. Using the MAXROWS parameter, we are limiting our
display to 4 rows.
<P>
<CFOUTPUT QUERY="GetCourses" MAXROWS=4>
<PRE>#Dept_ID##CorName##CorLevel#</PRE>
</CFOUTPUT>
<P>CFOUTPUT can also show the results of a more complex expression,
such as getting the day of the week from today’s date. We first
extract the integer representing the Day of the Week from
the server function Now() and then apply the result to
the DayofWeekAsString function:
<BR>Today is #DayofWeekAsString(DayofWeek(Now()))#
<BR>Today is <CFOUTPUT>#DayofWeekAsString(DayofWeek(Now()))#</CFOUTPUT>
<P>
</BODY>
</HTML>
Содержание COLDFUSION 4.5-CFML LANGUAGE
Страница 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Страница 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Страница 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Страница 296: ...272 CFMLLanguageReference INPUT TYPE text NAME number2 BR INPUT TYPE submit NAME submit VALUE Add FORM BODY HTML...
Страница 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Страница 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Страница 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Страница 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Страница 557: ...Chapter 2 ColdFusion Functions 533 P CFOUTPUT Value i is employee keysToStruct i CFOUTPUT P CFLOOP CFIF BODY HTML...
Страница 584: ...560 CFMLLanguageReference...
Страница 594: ...570 CFMLLanguageReference...