Use Language on Error Handling - show_error() |
Hi,
I need to use language on Error Handling - show_error() and show_404() but I don't find a way to do that. For exemple the file "system/core/Security.php" the function csrf_show_error() have the text error directly here. Is it a simple way to use my language file for this ? I tried to load view on "application/views/errors/html/error_general.php" to use a specific header and footer view on this error but I can't. Do you know what I need to do that ? Thanks for your help ![]()
You can use the language helper function to define the different languages on errors.
PHP Code: echo lang('language_key'); for more information see: https://codeigniter.com/userguide3/helpe...elper.html
Thanks for this reply but it's not working. I got this error when I try to use this.
Form Security.php Quote:public function csrf_show_error() Quote:Type: Error If I try have got a new error Quote:public function csrf_show_error() Quote:A PHP Error was encountered
We can't load helper on /var/www/gml-app/gml_system/core/Security.php, it's not working. :-(
(11-23-2020, 07:59 AM)nicolas33770 Wrote: We can't load helper on /var/www/gml-app/gml_system/core/Security.php, it's not working. :-( Yes you can, just override this class with a MY_ class. Would be something like this, did not test this so feel free to improve PHP Code: <?php defined('BASEPATH') OR exit('No direct script access allowed');
Thanks for your help ! I just have 2 more question please :
- Where I put the MY_Security.php file ? - Is it possible to improve your code to load my views/header_view.php ? (11-23-2020, 08:21 AM)nicolas33770 Wrote: Thanks for your help ! I just have 2 more question please : Did you read the documentation about this? - https://codeigniter.com/userguide3/gener...asses.html
I must admit that it seems to me quite complex especially if I have to create a specific and class page for each of the error pages (error_404, error_db, error_exception, error_general, ...)
I never indeed use these functions extension. I would just like to personalize all these pages simply. I would just like to be able to load a view ( $this->load->view('header'); ) in "gml_application/views/errors/html/error_404.php" but it also doesn't work. I guess it's because of CI_Controller not being loaded, I may not know how to load it either. It is all very technical. |
Welcome Guest, Not a member yet? Register Sign In |