Feature Language Change PR-5.0-dev Pending

User tests: Successful: Unsuccessful:

avatar brianteeman
brianteeman
15 May 2023

Summary of Changes

Adds a module position to the error.php page of cassiopeia so that you can customise the 404 page without having to change language strings or asking the user to modify the error.php (which they will lose on update)

This is fully backwards compatible as the existing error page text is displayed if there is no module. If debug is enabled then the debug information is still displayed

In theory the error.php is used by joomla for all error codes so this PR is able to display a specific module for each error code.

Testing Instructions

Apply the PR
Create a new module (custom html is probably the most useful) and publish in the new position error-404
Go to a fake page on your site and you will see the 404 page with your new module
Unpublish the module and repeat and you will see the original 404 page with the language strings

Original 404

image

Example 404 AFTER applying this Pull Request and creating a module

image

image

If accepted then I will create a guided tour for this and post-installation message

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

cc @crystalenka @HLeithner @alexandreelise

avatar joomla-cms-bot joomla-cms-bot - change - 15 May 2023
Category Language & Strings Front End Templates (site)
avatar brianteeman brianteeman - open - 15 May 2023
avatar brianteeman brianteeman - change - 15 May 2023
Status New Pending
avatar brianteeman brianteeman - change - 15 May 2023
The description was changed
avatar brianteeman brianteeman - edited - 15 May 2023
avatar rdeutz
rdeutz - comment - 15 May 2023

Nice.

Just one idea: could we have a generic error position error-default to have a non technical error message by default. (Can be done in a different PR OFC)

avatar brianteeman
brianteeman - comment - 15 May 2023

Nice.

Just one idea: could we have a generic error position error-default to have a non technical error message by default. (Can be done in a different PR OFC)

My feeling was that is what the existing text is for and that will be displayed when it is not a 404 (or 403 if you have a module for that as well.)

I'm not sure what other error codes ever make it to the error.php file

avatar ManuelHu
ManuelHu - comment - 16 May 2023

First, this is great ?

My feeling was that is what the existing text is for and that will be displayed when it is not a 404 (or 403 if you have a module for that as well.)

But the existing text also contains guidance that - more or less - only applies to 404/403 errors. (i.e. anything about "out-of-date bookmarks" or "mistyped addresses", "no access"...)
If the 404/403 errors are customized, this then should also be possible with the remaining errors...

Another note: as the module is dependant on the error code, creating a module in position error-0 should actually catch most usual PHP Errors and Exceptions (i.e. those which do not set an error code).

avatar brianteeman
brianteeman - comment - 16 May 2023

If the 404/403 errors are customized, this then should also be possible with the remaining errors...

It is possible with this code already. I just did not add a pre-defined module for every possible error code.

Another note: as the module is dependant on the error code, creating a module in position error-0 should actually catch most usual PHP Errors and Exceptions (i.e. those which do not set an error code).

Are you sure that the error.php is used in those scenario? This pr is NOT changing the way that errors are handled. It ONLY allows for changes in the infornmation dispplayed

avatar ManuelHu
ManuelHu - comment - 22 May 2023

It is possible with this code already. I just did not add a pre-defined module for every possible error code.

I know. My comment was just a case for the addition of a default/fallback error module. (so that you don't have to define a rather hacky error-0 module) Apart from that, it is not guaranteed that the code is always 0 for all generic/non HTTP error exceptions...

Are you sure that the error.php is used in those scenario? This pr is NOT changing the way that errors are handled. It ONLY allows for changes in the infornmation dispplayed

I am quite sure that - at least in J!3 - the frontend error.php was also called for generic exceptions or sometimes even PHP Errors. I did not 'test' this yet with J!4 (read, I never had a site that broken yet :-)

avatar brianteeman
brianteeman - comment - 22 May 2023

When you are sure that its true in j4 ...

avatar ManuelHu
ManuelHu - comment - 7 Jun 2023

I just verified in J!4.3: When an Exception is thrown somewhere (e.g. in a template override), the error.php is called and $this->error->getCode() == 0.

avatar brianteeman brianteeman - change - 24 Jun 2023
Labels Added: Feature Language Change PR-5.0-dev
avatar HLeithner HLeithner - close - 26 Jun 2023
avatar HLeithner HLeithner - merge - 26 Jun 2023
avatar HLeithner HLeithner - change - 26 Jun 2023
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-06-26 07:57:45
Closed_By HLeithner
avatar HLeithner
HLeithner - comment - 26 Jun 2023

thanks, would you be so kind a create a pr for the system template too?

I think documentation at manual.joomla.org would also make sense

avatar brianteeman
brianteeman - comment - 26 Jun 2023

THANK YOU!!!

I will create the docs later today

Add a Comment

Login with GitHub to post a comment