2015-07-26, 05:15 PM
Since I'm solely using MyBB on one of the websites, it makes sense to integrate the error pages with the forum as a whole. I have just one problem; the error pages work great if you're under the /forum directory (where MyBB is installed). Anywhere outside that directory, something is not linking right to allow you to be "logged in" on the error page.
PHP File
Template
PHP File
<?php
define('IN_MYBB', 1);
require "./forum/global.php";
global $db;
add_breadcrumb("404 Error - Document Not Found", "404.php"); // (2)
$url = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$date = new DateTime();
$timeStamp = $date->format('m-d-Y H:i:s');
eval("\$errorPage = \"".$templates->get("404")."\";");
output_page($errorPage);
?>
Template
<html>
<head>
<title>404 Error - Document Not Found</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder tfixed clear">
<tr>
<td class="thead">
<div>
<strong>404 Error - Document Not Found</strong><br />
</div>
</td>
</tr>
<tr>
<td id="posts_container">
<div id="posts">
<div class="post" style=""><br />
<div class="post_content ">
<div class="post_head">
<span class="post_date">{$timeStamp}</span>
</div>
<div class="post_body scaleimages">
The requested object or URL, <b><a href="{$url}">{$url}</a></b> was not found on this server.
The link you followed is either outdated, inaccurate, or the server has been instructed not to let you have it.<P>
Please inform the administrator of the referring page, <b><a href="{$url}">{$url}</a></b>.
</div>
</div>
</div>
</div>
<br />
</td>
</tr>
</table>
<br class="clear" />
{$usersbrowsing}
{$footer}
</body>
</html>