Welcome Guest, Not a member yet? Register   Sign In
language version in errors - how?
#1

[eluser]fajnalowiec[/eluser]
I use the errors CI files with my layout stored in app/errors such us 'error_404.php' and others. It is quite convenient way for me.
But I don't know for example how to show error_404.php in the language the user watched the site. I have session on database and it' s encoded, and in error_404.php I am not even able to do this:

$CI =& get_instance();

so I don' t even know how to figure out what language I should use.
#2

[eluser]toopay[/eluser]
I'm affraid, you must include all files which needed by your controller, like session class, database class, languange file etc, since CI super object is no longer exist in 404 controller.

For languange files, thats a obvious reason, since we need display different languange for different user, but why you need to use session here? I mean, clearly, 404 is the http response which generated if someone want to access something that not exist, so the content that should be generated is only some simple message that tell the user no content for that url, right? Why you need to process session and other stuff? ;-)
#3

[eluser]fajnalowiec[/eluser]
yep, in the simplest case I just only print on 404 a message like "the page has not been found.". This message should be different (for example deutch) when a user view my site in deutch. I simply don't know how to do it. I just thought, I could store this info in the session, and then check the it in the error_404.php but obviously it is quite annoying when I use the native CI session on the database.




Theme © iAndrew 2016 - Forum software by © MyBB