![]() |
| Frontier Tutorials / Writing an ObjectNotFoundHandler / ONFH Summary |
We have examined three modes in which ONFH scripts can operate:
Mode 1, in which the script simply renders and returns the content of the page, to be inserted into the site template (whatever template is in effect at that point).
Mode 2, in which the script simply redirects to a different URL. In the example, we redirected to a FileNotFound page in the current site, but the redirect could go to any valid URL. That's worth repeating: it could redirect to any valid URL!
Mode 3, in which the script stuffs response data directly into the page table, then bypasses further mainResponder processing by calling scriptError("!return").
We saw how to use multiple ONFH scripts in the same website. The steps are:
Create a master ONFH script that calls all Mode 3 and Mode 2 scripts in succession, then calls a Mode 1 script (or acts as a Mode 1 script itself) if none of the Mode 2 or Mode 3 scripts handled the URL.
Make sure all Mode 3 and Mode 2 scripts simply return to the caller if they are unable to handle a URL.
We saw how to ensure that a Mode 1 ONFH handler doesn't result in misdirected URLs.