[Solved] About Displaying Error Message

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Dakin Quelia
Registered User
Posts: 300
Joined: Thu Feb 14, 2008 10:07 pm
Location: Belgium
Name: Daniel Chalsèche
Contact:

[Solved] About Displaying Error Message

Post by Dakin Quelia » Fri Aug 24, 2018 6:25 am

Hello,

I'd like displaying Error Message when an url doesn't match page or the page doesn't exist.

How do that?

Thanks per advance. :)

Best regards
Last edited by Dakin Quelia on Sun Aug 26, 2018 6:31 am, edited 1 time in total.

User avatar
david63
Jr. Extension Validator
Posts: 15050
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: [Question] About Displaying Error Message

Post by david63 » Fri Aug 24, 2018 6:33 am

Withou more information of what you are doing and where you are doing it it is impossible to answer your question.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Dakin Quelia
Registered User
Posts: 300
Joined: Thu Feb 14, 2008 10:07 pm
Location: Belgium
Name: Daniel Chalsèche
Contact:

Re: [Question] About Displaying Error Message

Post by Dakin Quelia » Fri Aug 24, 2018 6:42 am

By example, my route to my page : www.monsite.com/test exists and display the content.

If the page doesn't exist (with or without /) it displays a error message in my template file.

User avatar
3Di
Registered User
Posts: 13097
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [Question] About Displaying Error Message

Post by 3Di » Fri Aug 24, 2018 8:21 am

If you are using a controller for that route you have to use exceptions.
:game_die: The new Dice Roller extension for phpBB 3.2 is out! :game_die:

Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
Ger
Recognised Extension Developer
Posts: 1792
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: [Question] About Displaying Error Message

Post by Ger » Fri Aug 24, 2018 8:42 am

Do you mean something like this? https://github.com/GerB/cmbb/blob/maste ... #L107-L110
If an article does not exist, the controller helper throws a 404 not found error.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

User avatar
Dakin Quelia
Registered User
Posts: 300
Joined: Thu Feb 14, 2008 10:07 pm
Location: Belgium
Name: Daniel Chalsèche
Contact:

Re: [Question] About Displaying Error Message

Post by Dakin Quelia » Fri Aug 24, 2018 7:29 pm

Like this !

An error in template file. :)

User avatar
3Di
Registered User
Posts: 13097
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [Question] About Displaying Error Message

Post by 3Di » Sat Aug 25, 2018 11:34 pm

Code: Select all

{% if S_ERRORS %}
<fieldset>
	<legend>{{ lang('MY_AWESOME_EXT_ERRORS') }}</legend>
	<p class="error">
		{{ ERRORS_MSG }}
	</p>
</fieldset>
{% endif %}
and define an array of errors in the PHP side of things.

Code: Select all

$errors = array();

Code: Select all

				if (empty($blah))
				{
					$errors[] = $language->lang('BLAH_IS_EMPTY');
				}

Code: Select all

			$template->assign_vars(array(
				'S_ERRORS'						=> ($errors) ? true : false,
				'ERRORS_MSG'					=> implode('<br /><br />', $errors),
				// etc..
typed on the fly.
:game_die: The new Dice Roller extension for phpBB 3.2 is out! :game_die:

Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
Dakin Quelia
Registered User
Posts: 300
Joined: Thu Feb 14, 2008 10:07 pm
Location: Belgium
Name: Daniel Chalsèche
Contact:

Re: [Question] About Displaying Error Message

Post by Dakin Quelia » Sun Aug 26, 2018 6:31 am

Thank you, very much. :)

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: No registered users and 6 guests