• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Using the ColdFusion Applica... > Example: Using an OnRequestEnd.cfm F...

Example: Using an OnRequestEnd.cfm File

An OnRequestEnd.cfm file is similar to an Application.cfm file, except that the code within it is executed after the requested template has been processed rather than before. OnRequestEnd.cfm files are good for incorporating a common footer onto each ColdFusion-generated page and for doing standard processing at the end of a page. The short OnRequestEnd.cfm file shown in Listing 12.6 uses a <cfinclude> to drop in the footer code, and then a <cflog> tag is used to record a login event in a special log file.

Listing 12.6. A Sample OnRequestEnd.cfm File

<cfinclude template="footer.html">

<!---

   If the login processor script just ran, note
   Who logged on in a special log file.

--->

<cfif cgi.script_name contains "/processlogin.cfm">
   <cflog file="cfjobhunter" text="#Form.username# logged in.">
</cfif>


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint