Current time: 07-30-2014, 09:15 PM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
404 pages - Make your file not found page blend with your forum
12-03-2008, 12:51 AM
Post: #1
Smile 404 pages - Make your file not found page blend with your forum
OK guys, I'm not a coder, so I won't be able to support this hack. Having said that, let's get to it.

This will allow someone in your forum to type http://www.leftfordeadforum.com/whole-bunch-of-text
and instead of a default ugly 404 page, it will serve up a fully themed error page, that has a search box right there. Man, the people are gonna go wild for this Cool


1. You'll need to make a new global template
Admin CP > Templates > Modify / Delete > Expand "Global Templates" > Add template

and paste this in it
Code:
<html>
<head>
<title>404 File Not Found : {$mybb->settings[bbname]}</title>
{$headerinclude}
</head>
<body>
{$header}
<br />
<table width="100%" border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead">  <strong>File Not Found</strong></td>
</tr>
<tr>
<td height="100" valign="top" class="trow1">Oh No!  It appears that the page you are looking for is either missing, or has moved.  Try searching in the box below to find what you need.</td>
</tr>
</table>

<div>
<br />
<br /></div>

<form method="post" action="./search.php">
<input type="hidden" name="action" value="do_search" />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>{$mybb->settings['bbname']} - {$lang->search}</strong></td>
</tr>
<tr>
<td class="tcat" width="50%"><strong>{$lang->search_keyword}</strong></td>
<td class="tcat" width="50%"><strong>{$lang->search_username}</strong></td>
</tr>
<tr>
<td class="trow1">
<table><tr>
<td valign="top"><input type="text" class="textbox" name="keywords" size="35" maxlength="250" /></td>
</tr>
<tr>
<td>
<span class="smalltext"><input type="radio" class="radio" name="postthread" value="1" checked="checked" />{$lang->search_entire_post}<br /><input type="radio" class="radio" name="postthread" value="2" />{$lang->search_titles_only}</span></td>
</tr></table>
</td>
<td class="trow1">
<table><tr>
<td class="trow1"><input type="text" class="textbox" id="author" name="author" size="35" maxlength="{$mybb->settings['maxnamelength']}" /><br /><span class="smalltext"><input type="checkbox" class="checkbox" name="matchusername" value="1" checked="checked" />&nbsp; {$lang->match_username}</span></td>
<td class="trow1">&nbsp;</td>
</tr></table>
</td>
</tr>

<tr>
<td class="trow1" rowspan="5">{$srchlist}</td>
<td class="trow1">

<select name="postdate">
<option value="0">{$lang->find_anydate}</option>
<option value="1">{$lang->find_yesterday}</option>
<option value="7">{$lang->find_lastweek}</option>
<option value="14">{$lang->find_2weeks}</option>
<option value="30">{$lang->find_month}</option>
<option value="90">{$lang->find_3months}</option>
<option value="180">{$lang->find_6months}</option>
<option value="365">{$lang->find_year}</option>
</select>&nbsp;&nbsp; <input type="radio" class="radio" name="pddir" value="1" checked="checked" />{$lang->and_newer}  <input type="radio" class="radio" name="pddir" value="0" />{$lang->and_older}
</td>
</tr>
<tr>
<td class="tcat"><strong>{$lang->sorting_options}</strong></td>
</tr>
<tr>
<td class="trow1">
<select name="sortby">
<option value="lastpost">{$lang->sort_lastpost}</option>
<option value="starter">{$lang->sort_author}</option>
<option value="forum">{$lang->sort_forum}</option>
</select> {$lang->sort_in} <input type="radio" class="radio" name="sortordr" value="asc" />{$lang->sort_asc} <input type="radio" class="radio" name="sortordr" value="desc" checked="checked" />{$lang->sort_desc} {$lang->sort_order}
</td>
</tr>
<tr>
<td class="tcat"><strong>{$lang->display_options}</strong></td>
</tr>
<tr>
<td class="trow1">{$lang->show_results_as} <input type="radio" class="radio" name="showresults" value="threads" checked="checked" />{$lang->show_results_threads} <input type="radio" class="radio" name="showresults" value="posts" />{$lang->show_results_posts}</td>
</tr>
</table>
<div align="center"><br /><input type="submit" class="button" name="submit" value="{$lang->search}" /></div>
</form>
<br />
<div align="right"><br /> 404 page coded by <a href="http://www.leftfordeadforum.com" target="blank">Left 4 Dead forum</a></div>


{$footer}
</body>
</html>
- feel free to remove the link to my forum if you'd like Blush

2. Upload the attached 404.php into your forum root

.php  404.php (Size: 247 bytes / Downloads: 117)

3. Add this to the htaccess file in your forum's root (or create a .htaccess if you don't have one)
Code:
ErrorDocument 404 /404.php

That's it, you're done!

In the interest of full disclosure, I was able to put this together based on the work of others, mainly through this thread

[Image: sig.jpg]
Find all posts by this user
Quote this message in a reply
12-03-2008, 10:59 PM
Post: #2
RE: 404 pages - Make your file not found page blend with your forum
Hm, I like it. I'll do this, thanks. Smile

[Image: logo.png]
Find all posts by this user
Quote this message in a reply
02-25-2009, 12:37 AM
Post: #3
RE: 404 pages - Make your file not found page blend with your forum
Nice, exactly what I was looking for.

Small note to others trying this (although it should be clear to most):
* The new template should have "404" as title
* Make sure you do a right click > save as on 404.php (I messed up the download on first try Smile)

Menthix.net | Contact Me
Visit this user's website Find all posts by this user
Quote this message in a reply
02-25-2009, 01:39 AM
Post: #4
RE: 404 pages - Make your file not found page blend with your forum
I'm glad others were able to use this!

[Image: sig.jpg]
Find all posts by this user
Quote this message in a reply
02-25-2009, 03:19 AM
Post: #5
RE: 404 pages - Make your file not found page blend with your forum
I may use this later Wink
Visit this user's website Find all posts by this user
Quote this message in a reply
02-25-2009, 05:06 PM
Post: #6
RE: 404 pages - Make your file not found page blend with your forum
(02-25-2009 03:19 AM)Elegant Totality Wrote:  I may use this later Wink

Same. Looks very cool.

<snip - "too big"> despite many sigs on here being much larger and approved - sort it out instead of removing sigs without warning
Find all posts by this user
Quote this message in a reply
02-27-2009, 06:33 PM
Post: #7
RE: 404 pages - Make your file not found page blend with your forum
I'll test this on localhost and see how it works out. Wink

I'm not even angry. I'm being so sincere right now, even though you broke my heart and killed me. And tore me to pieces, and threw every piece into a fire.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication