• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Allowing Missing Templates to pass through to onRequestStart method

New Here ,
Oct 24, 2010 Oct 24, 2010

Copy link to clipboard

Copied

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) ????

TOPICS
Advanced techniques

Views

364

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 24, 2010 Oct 24, 2010

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation