home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / cfoutput.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.5 KB  |  49 lines

  1. <!--- This example shows how CFOUTPUT operates --->
  2.  
  3. <!--- run a sample query --->
  4. <CFQUERY name="GetCourses" DATASOURCE="cfsnippets">
  5. SELECT Dept_ID, CorName, CorLevel
  6. FROM CourseList
  7. ORDER by Dept_ID, CorLevel, CorName
  8.  
  9. </CFQUERY>
  10. <HTML>
  11. <HEAD>
  12. <TITLE>CFOUTPUT</TITLE>
  13. </HEAD>
  14.  
  15. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  16. <BODY  bgcolor="#FFFFD5">
  17.  
  18. <H3>CFOUTPUT Example</H3>
  19.  
  20. <P>CFOUTPUT simply tells the Cold Fusion Application Server
  21. to begin processing, and then to hand back control
  22. of page rendering to the web server.
  23.  
  24. <P>For example, to show today's date, you could write
  25. #DateFormat(Now()).  If you enclosed that expression
  26. in CFOUTPUT, the result would be <CFOUTPUT>#DateFormat(Now())#</CFOUTPUT>.
  27.  
  28. <P>In addition, CFOUTPUT may be used to show the results of
  29. a query operation, or only a partial result, as shown:
  30.  
  31. <P>There are <CFOUTPUT>#getCourses.recordCount#</CFOUTPUT> total records in our
  32. query.  Using the MAXROWS parameter, we are limiting our
  33. display to 4 rows.
  34. <P>
  35. <CFOUTPUT query="GetCourses" MAXROWS=4>
  36. <PRE>#Dept_ID#    #CorName#    #CorLevel#</PRE>
  37. </CFOUTPUT>
  38.  
  39. <P>CFOUTPUT can also show the results of a more complex expression,
  40. such as getting the day of the week from today's date.  We first
  41. extract the integer representing the Day of the Week from
  42. the server function Now() and then apply the result to
  43. the DayofWeekAsString function:
  44.  
  45. <BR>Today is #DayofWeekAsString(DayofWeek(Now()))#
  46. <BR>Today is <CFOUTPUT>#DayofWeekAsString(DayofWeek(Now()))#</CFOUTPUT>
  47.  
  48. </BODY>
  49. </HTML>