Using onRequestEnd()

The Web application framework also reserves the special OnRequestEnd method, which is executed automatically at the end of every page request, rather than at the beginning. Listing 19.3 is a modification of Listing 19.1. This time our Application.cfc includes an onRequestEnd method. It has just one line of code, a simple <cfinclude> tag to include the SiteFooter.cfm template at the bottom of every page. Listing 19.4 shows the SiteFooter.cfm file itself, which displays a copyright notice. The net effect is that the copyright notice is displayed at the bottom of every page in the application, as shown in Figure 19.2.

Figure 19.2. The application framework makes it easy to keep things consistent throughout your site.

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.