![]() |
Sometimes weird things happens...
I'm developing my web site locally on my PC...things run quite fine... I have installed Codeigniter Shield ...and now I got the following error: ![]() Any help or hint to fix the issue? Thanks a lot In my Base Controller I have the following code to have multi language functions: Code: public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
To quote the documentation Initializing a Session:
Quote:Sessions will typically run globally with each page load, so the Session class should be magically initialized.Languages are already also handled by Localization. I don't know why you're reinventing the wheel in your BaseController, but stop it.
Thanks for feedback and hints grimpirate, I really appreciate it.
I don't wanto to reinvent the wheel... I'm trying to add a feature ( just a Selection menu in header page) to allow users to switch among the languages in supportedLocales array. For what I know ( very poor ) Codeigniter has no such features...but any suggestion on this is appreciated. I got the issue... The following code doesn't work anymore, ( weird...it worked fine before Shield installation ): Code: if (session_status() == PHP_SESSION_NONE){}
If what you want is a dropdown that shows values in the language you're using here is some sample code:
PHP Code: <?php Then in your app/Languages you would create subdirectories for each of your languages let's say your supportedLocales was en, es. You would then create a file called Language.php in each directory. In app/Languages/en/Language.php PHP Code: <?php In app/Languages/es/Language.php PHP Code: <?php CodeIgniter takes care of determining the language you want displayed (based on user's browser settings) and substitutes accordingly. Then you submit/validate however you feel appropriate, push into your session, and your code in your BaseController's initController method for setting the language becomes: PHP Code: public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) |
Welcome Guest, Not a member yet? Register Sign In |