public static function render($e) { $page_id = Symphony::Database()->fetchVar('page_id', 0, "SELECT `page_id` FROM `tbl_pages_types` WHERE `type` = '404' LIMIT 1"); if (is_null($page_id)) { parent::render(new SymphonyErrorPage(__('The page you requested does not exist.'), __('Page Not Found'), 'error', array('header' => 'HTTP/1.0 404 Not Found'))); } else { $url = '/' . Frontend::instance()->resolvePagePath($page_id) . '/'; $output = Frontend::instance()->display($url); header(sprintf('Content-Length: %d', strlen($output))); echo $output; exit; } }
public static function render($e) { parent::render($e); }
/** * The render function will take a `FrontendPageNotFoundException` Exception and * output a HTML page. This function first checks to see if their is a page in Symphony * that has been given the '404' page type, otherwise it will just use the default * Symphony error page template to output the exception * * @param FrontendPageNotFoundException $e * The Exception object * @return string * An HTML string */ public static function render(Exception $e) { $page = PageManager::fetchPageByType('404'); if (is_null($page['id'])) { parent::render(new SymphonyErrorPage($e->getMessage(), __('Page Not Found'), 'generic', array('header' => 'HTTP/1.0 404 Not Found'))); } else { $url = '/' . PageManager::resolvePagePath($page['id']) . '/'; $output = Frontend::instance()->display($url); header(sprintf('Content-Length: %d', strlen($output))); echo $output; exit; } }
/** * The render function will take a `FrontendPageNotFoundException` Exception and * output a HTML page. This function first checks to see if their is a page in Symphony * that has been given the '404' page type, otherwise it will just use the default * Symphony error page template to output the exception * * @param Exception $e * The Exception object * @throws FrontendPageNotFoundException * @throws SymphonyErrorPage * @return string * An HTML string */ public static function render(Exception $e) { $page = PageManager::fetchPageByType('404'); $previous_exception = Frontend::instance()->getException(); // No 404 detected, throw default Symphony error page if (is_null($page['id'])) { parent::render(new SymphonyErrorPage($e->getMessage(), __('Page Not Found'), 'generic', array(), Page::HTTP_STATUS_NOT_FOUND)); // Recursive 404 } elseif (isset($previous_exception)) { parent::render(new SymphonyErrorPage(__('This error occurred whilst attempting to resolve the 404 page for the original request.') . ' ' . $e->getMessage(), __('Page Not Found'), 'generic', array(), Page::HTTP_STATUS_NOT_FOUND)); // Handle 404 page } else { $url = '/' . PageManager::resolvePagePath($page['id']) . '/'; Frontend::instance()->setException($e); $output = Frontend::instance()->display($url); echo $output; exit; } }