home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / cfoutput.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.5 KB  |  46 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. <BODY>
  15. <H3>CFOUTPUT Example</H3>
  16.  
  17. <P>CFOUTPUT simply tells the Cold Fusion Application Server
  18. to begin processing, and then to hand back control
  19. of page rendering to the web server.
  20.  
  21. <P>For example, to show today's date, you could write
  22. #DateFormat("#Now()#").  If you enclosed that expression
  23. in CFOUTPUT, the result would be <CFOUTPUT>#DateFormat("#Now()#")#</CFOUTPUT>.
  24.  
  25. <P>In addition, CFOUTPUT may be used to show the results of
  26. a query operation, or only a partial result, as shown:
  27.  
  28. <P>There are <CFOUTPUT>#getCourses.recordCount#</CFOUTPUT> total records in our
  29. query.  Using the MAXROWS parameter, we are limiting our
  30. display to 4 rows.
  31. <P>
  32. <CFOUTPUT query="GetCourses" MAXROWS=4>
  33. <PRE>#Dept_ID#    #CorName#    #CorLevel#</PRE>
  34. </CFOUTPUT>
  35.  
  36. <P>CFOUTPUT can also show the results of a more complex expression,
  37. such as getting the day of the week from today's date.  We first
  38. extract the integer representing the Day of the Week from
  39. the server function Now() and then apply the result to
  40. the DayofWeekAsString function:
  41.  
  42. <BR>Today is #DayofWeekAsString("#DayofWeek("#Now()#")#")#
  43. <BR>Today is <CFOUTPUT>#DayofWeekAsString("#DayofWeek("#Now()#")#")#</CFOUTPUT>
  44.  
  45. </BODY>
  46. </HTML>