User tests: Successful: Unsuccessful:
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.
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
If accepted then I will create a guided tour for this and post-installation message
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
Category | ⇒ | Language & Strings Front End Templates (site) |
Status | New | ⇒ | Pending |
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
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 Error
s and Exception
s (i.e. those which do not set an error code).
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
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 :-)
When you are sure that its true in j4 ...
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
.
Labels |
Added:
Feature
Language Change
PR-5.0-dev
|
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-06-26 07:57:45 |
Closed_By | ⇒ | HLeithner |
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
THANK YOU!!!
I will create the docs later today
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)