Skip to main content
Participant
October 24, 2010
Question

Allowing Missing Templates to pass through to onRequestStart method

  • October 24, 2010
  • 1 reply
  • 387 views

Need some help with trying to build virtual webpages.  What I am trying to do is allow the user to create and edit their own pages.  To do this, I want to create the page on the fly based on inlcudes and data - so the actual page never exists.

Example:    http://mysite.com/coolpage1.cfm

The actual template, coolpage1.cfm is not a file on the webserver.  I have set IIS to not Check that File Exists so IIS passes the page name coolpage1.cfm on to CF7 (unfortunately, I am stuck on CF7 for this client).  From their, it appears that CF7 first checks for the existence of the template and throws the appropriate error message if it doesn't exist.

In my scenario, it never exists and will never exist.  With Railo, the OnApplicationStart, OnSessionStart, OnRequestStart methods all fire before the existance of the template is checked.  Thus, in OnRequestStart, I can build the appropriate page with includes and data and then <cfreturn false> from the method so that further processing in Railo is stopped and the what was built in OnRequestStart is returned to the browser.  This makes it appear to that this page exists but it doesn't actually ever exist.

It appears in CF7 that the existance of the template is checked before CF7 starts firing the methods in the application.cfc ....   If this is the case, I can't do this type of processing.  (I also tried trapping the "File Not Found" error using the onError() method but that too doesn't seem to come into play until after existance fo the template is checked.

Can any confirm this behavior?  Or set me straight on something I am missing ....

Has someone figured out a way to do this type of thing with CF7 (or CF8, or CF9) ????

This topic has been closed for replies.

1 reply

dave_jf
Participating Frequently
October 24, 2010

You can probably do this with a custom 404 handler in IIS. You could then envoke another cfm file to process the request. You will have to have IIS verify that the file exists for this to work.

--Dave