Search the Community
Showing results for tags 'main.inc'.
-
I have a project that uses a variant of the "main.inc" template strategy. All templates are set to use a single "main.php" file. That file uses output buffering to include page-specific views and insert them into a "base" template. Generally, this works great and allows me to structure my files exactly the way I want. However, I've found that if I want to manually throw a Wire404Exception, it just bubbles up uncaught rather than being handled. The 404 handler works fine in instances where I'm not calling it manually, but fails otherwise, specifically when I'm dealing with urlSegments. I'm not that familiar with PHP's exception handling in general nor ProcessWire's exception handling in particular, so I'm not sure how to further troubleshoot. Some abbreviated pseudo-code to illustrate: main.php: ob_start(); include('./views/'.$view.'/'.$view.'.inc'); $layout = ob_get_clean(); ob_start(); include('./views/base/base.inc'); $template = ob_get_clean(); echo $template; With this setup, if I try to throw a Wire404Exception within any "view", the exception isn't handled, so logged in admins see the error trace, and regular users get an ISE. e.g., view.inc: if($input->urlSegment1){ // look for stuff... if(!$match){ throw new Wire404Exception(); } } Any thoughts?
- 6 replies
-
- main.inc
- urlsegment
-
(and 1 more)
Tagged with: