Integrated Error Messages

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Locked
User avatar
Muad''Dib
Registered User
Posts: 311
Joined: Tue Jun 12, 2007 6:20 pm
Contact:

Re: Integrated Error Messages

Post by Muad''Dib »

I customized mine:

http://www.jeepstrokers.com/forum/doesntexist/this.php

http://www.jeepstrokers.com/forum/styles/

Its easy by adding something like this to error.php:

Code: Select all

//Define our page body depending on mode:
switch ($mode)
{
	case '400':
		$template->set_filenames(array(
    		'body' => 'errors/400_body.html',
		));
	break;
	case '401':
		$template->set_filenames(array(
    		'body' => 'errors/401_body.html',
		));
	break;
	case '403':
		$template->set_filenames(array(
    		'body' => 'errors/403_body.html',
		));
	break;
	case '404':
		$template->set_filenames(array(
    		'body' => 'errors/404_body.html',
		));
	break;
	case '500':
		$template->set_filenames(array(
    		'body' => 'errors/500_body.html',
		));
	break;
	default:
		$template->set_filenames(array(
    		'body' => 'errors/default_body.html',
		));
	break;
}
Just create that directory and files. The files will become the page body of that particular error page.
psych0569fj
Registered User
Posts: 29
Joined: Fri Feb 08, 2008 3:28 pm

Re: Integrated Error Messages

Post by psych0569fj »

Code: Select all

Ok, I'll play around with that.

I also think I've managed to piece together a solution to part of my question. What I'd like to figure out now is:
How do I, using this integrated error messages mod, apply formatting to "guessed pages" not in the root?

For example, if I go to http://domain.tld/nonexistingfile.html, the error page renders beautifully.

If I go to http://domain.tld/subfolder/nonexistingfile.html, the text for the page is there, but it's stripped of all formatting (IE: ugly white background with blue/purple links and no images)
edit: I'm an idiot :P

It turns out there are "install" files in the templates folder in addition to the install file in the root that does exactly what I need.
User avatar
GoBieN
Registered User
Posts: 546
Joined: Fri Mar 05, 2004 5:22 pm
Location: Belgium
Contact:

Re: Integrated Error Messages

Post by GoBieN »

psych0569fj wrote:

Code: Select all

Ok, I'll play around with that.

I also think I've managed to piece together a solution to part of my question. What I'd like to figure out now is:
How do I, using this integrated error messages mod, apply formatting to "guessed pages" not in the root?

For example, if I go to http://domain.tld/nonexistingfile.html, the error page renders beautifully.

If I go to http://domain.tld/subfolder/nonexistingfile.html, the text for the page is there, but it's stripped of all formatting (IE: ugly white background with blue/purple links and no images)
edit: I'm an idiot :P

It turns out there are "install" files in the templates folder in addition to the install file in the root that does exactly what I need.
if you go back a few pages, you'll find me making the same mistake ;)
kmxak
Registered User
Posts: 21
Joined: Tue May 05, 2009 6:48 pm

Re: Integrated Error Messages

Post by kmxak »

hello

i want wo modify my error messages

the code is:

Code: Select all

switch ($type)
{
	case 401:
		$page_title = $user->lang['401_TITLE'];
		$page_description = $user->lang['401_DESCRIPTION'];
	break;

	case 403:
		$page_title = $user->lang['403_TITLE'];
		$page_description = $user->lang['403_DESCRIPTION'];
	break;
	
	case 404:
		$page_title = $user->lang['404_TITLE'];
		$page_description = $user->lang['404_DESCRIPTION'];
	break;
	
	case 500:
		$page_title = $user->lang['500_TITLE'];
		$page_description = $user->lang['500_DESCRIPTION'];
	break;
}
and i want to replace the $page_description = with an html file

who can help

the post from by Muad''Dib » Tue May 05, 2009 7:30 pm did not work
User avatar
Muad''Dib
Registered User
Posts: 311
Joined: Tue Jun 12, 2007 6:20 pm
Contact:

Re: Integrated Error Messages

Post by Muad''Dib »

If anyone is looking to customize thier error messages like i did, here are some instructions:

error.php:
Find:

Code: Select all

//set title of error page
$msg_title = $user->lang['ERROR_TITLE'];

$mode = request_var('mode', 0);
switch ($mode)
{
	case '400':
	trigger_error('ERROR_BAD_REQUEST');
	break;
	case '401':
		trigger_error('ERROR_AUTH_REQUIRED');
	break;
	case '403':
		trigger_error('ERROR_FORBIDDEN');
	break;
	case '404':
		trigger_error('ERROR_NOT_FOUND');
	break;
	case '500':
		trigger_error('ERROR_INT_SERVER');
	break;
	default:
		trigger_error('ERROR_UNKNOWN');
	break;
}
Replace with:

Code: Select all

$mode = request_var('mode', 0);

$page_title = '';

//Set title of error page, and define page body depending on mode
switch ($mode)
{
	case '400':
		$page_title = $user->lang['ERROR_TITLE_400'];
		$template->set_filenames(array(
    		'body' => 'errors/400_body.html',
		));
	break;
	case '401':
		$page_title = $user->lang['ERROR_TITLE_401'];
		$template->set_filenames(array(
    		'body' => 'errors/401_body.html',
		));
	break;
	case '403':
		$page_title = $user->lang['ERROR_TITLE_403'];
		$template->set_filenames(array(
    		'body' => 'errors/403_body.html',
		));
	break;
	case '404':
		$page_title = $user->lang['ERROR_TITLE_404'];
		$template->set_filenames(array(
    		'body' => 'errors/404_body.html',
		));
	break;
	case '500':
		$page_title = $user->lang['ERROR_TITLE_500'];
		$template->set_filenames(array(
    		'body' => 'errors/500_body.html',
		));
	break;
	default:
		$page_title = $user->lang['ERROR_TITLE_UNKNOWN'];
		$template->set_filenames(array(
    		'body' => 'errors/default_body.html',
		));
	break;
}

page_header($page_title);

make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
language/en/mods/error.php:
Find:

Code: Select all

$lang = array_merge($lang, array(
	'ERROR_TITLE'				=> 'Error',
	'ERROR_BAD_REQUEST'			=> 'Error 400: Bad Request',
	'ERROR_AUTH_REQUIRED'			=> 'Error 401: Authorization Required',
	'ERROR_FORBIDDEN'			=> 'Error 403: Forbidden',
	'ERROR_NOT_FOUND'			=> 'Error 404: File Not Found',
	'ERROR_INT_SERVER'			=> 'Error 500: Internal Server Error',
	'ERROR_UNKNOWN'				=> 'Unknown Server Error',
));
Replace with:

Code: Select all

$lang = array_merge($lang, array(
	'ERROR_TITLE_400'			=> 'Error 400: Bad Request',
	'ERROR_TITLE_401'			=> 'Error 401: Authorization Required',
	'ERROR_TITLE_403'			=> 'Error 403: Forbidden',
	'ERROR_TITLE_404'			=> 'Error 404: Page Not Found',
	'ERROR_TITLE_500'			=> 'Error 500: Internal Server Error',
	'ERROR_TITLE_UNKNOWN'		=> 'Unknown Server Error',
));
Now you need to create your own error pages and put them in the following folder:

styles/prosilver/template/errors (you will need to create this folder!)

Here is the list of custom pages that are needed to be made:

400_body.html
401_body.html
403_body.html
404_body.html
500_body.html
default_body.html

From here its up to you on how you want to customize these pages. You can add whatever you want its all up to you. As an example here is my default_body.html:

Code: Select all

<!-- INCLUDE overall_header.html -->

<h2><img alt="" src="<!-- PHP -->$phpbb_root_path<!-- ENDPHP -->./styles/prosilver/template/errors/image.jpg" width="47" height="48" style="float: left" />&nbsp; GENERAL ERROR - Unknown Server Error</h2>
<br style="clear:both" />
<div class="panel">
   <div class="inner"><span class="corners-top"><span></span></span>
   <div class="content">
   <p style="text-align:center">Can you get any more generic? Come on... you can make us send you a better error than this! Who knows what happened!!</p>
   <p style="text-align:center">If you have followed a valid link go <input type="button" value="Back" onclick="history.back();" /> to the previous page, or <a href="<!-- PHP -->$phpbb_root_path<!-- ENDPHP -->./memberlist.php?mode=leaders" style="color:#00F">let us know</a> about the error.</p>
   <p style="text-align:center">You can also use the <a href="<!-- PHP -->$phpbb_root_path<!-- ENDPHP -->./search.php" style="color:#00F">Search</a> to find specific pages here at {SITENAME}.</p>
   </div>
   <span class="corners-bottom"><span></span></span></div>
</div>

<!-- INCLUDE jumpbox.html -->
<!-- INCLUDE overall_footer.html -->
and 404_body.html:

Code: Select all

<!-- INCLUDE overall_header.html -->

<h2><img alt="" src="<!-- PHP -->$phpbb_root_path<!-- ENDPHP -->./styles/prosilver/template/errors/image.jpg" width="47" height="48" style="float: left" />&nbsp; ERROR 404 - Page Not Found</h2>
<br style="clear:both" />
<div class="panel">
   <div class="inner"><span class="corners-top"><span></span></span>
   <div class="content">
   <p style="text-align:center">Oops! Looks like the page you're looking for was moved or never existed. Make sure you typed the correct URL or followed a valid link.</p>
   <p style="text-align:center">If you have followed a valid link go <input type="button" value="Back" onclick="history.back();" /> to the previous page, or <a href="<!-- PHP -->$phpbb_root_path<!-- ENDPHP -->./memberlist.php?mode=leaders" style="color:#00F">let us know</a> about the error.</p>
   <p style="text-align:center">You can also use the <a href="<!-- PHP -->$phpbb_root_path<!-- ENDPHP -->./search.php" style="color:#00F">Search</a> to find specific pages here at {SITENAME}.</p>
   </div>
   <span class="corners-bottom"><span></span></span></div>
</div>

<!-- INCLUDE jumpbox.html -->
<!-- INCLUDE overall_footer.html -->
From here the rest of the pages should be very easy to make. You dont have to follow the format of phpbb like i did either. As long as you have some basic html skills, you should be able to make the pages whatever you want them to be.
Hope that helps you all.
vonhazey
Registered User
Posts: 89
Joined: Wed Dec 02, 2009 2:43 pm

Re: Integrated Error Messages

Post by vonhazey »

Great mod, thanks.
Image
slh550
Registered User
Posts: 6
Joined: Mon Mar 09, 2009 12:45 pm

Re: Integrated Error Messages

Post by slh550 »

Terrific, works a charm just what i was looking for.
ricjonhay
Registered User
Posts: 247
Joined: Tue Feb 16, 2010 6:08 pm

Re: Integrated Error Messages

Post by ricjonhay »

Easy install and works great on 3.0.7, thanks.
DjMorley
Registered User
Posts: 16
Joined: Thu Sep 11, 2008 7:25 pm

Re: Integrated Error Messages

Post by DjMorley »

This mod works 100% fine on my forum nice mod and now i can make my own error msg as i edited the defolt ones a bit lol

nice work :D
GlouGlou
Registered User
Posts: 168
Joined: Thu Mar 04, 2010 12:09 am

Re: Integrated Error Messages

Post by GlouGlou »

Hi,

I use this mod and works perfectly.
But now, i want to add an entry on the error's log.
I'm searching/trying, but no result for me.

Can someone know how to make this ?
Thx for your help.
User avatar
eeji
Jr. Style Validator
Posts: 1267
Joined: Fri Dec 12, 2008 9:08 pm
Location: Manchester, UK
Contact:

Re: Integrated Error Messages

Post by eeji »

thanks for a great mod that fixes an ugly problem! :D this really should be incorporated into the next major release of phpBB! :D
My phpBB styles: phpbbstyles.oo.gd
My board: iansvivarium.com
User avatar
Marc
Development Team Leader
Development Team Leader
Posts: 5470
Joined: Tue Oct 30, 2007 10:57 pm
Location: Munich, Germany
Name: Marc
Contact:

Re: Integrated Error Messages

Post by Marc »

MOD Updated to version 1.0.4
See first post for Download Link
Locked

Return to “[3.0.x] MOD Database Releases”