Welcome Guest, Not a member yet? Register   Sign In
Search Results
    Thread: Load language array
Post: RE: Load language array

I also was interested of this question here (https://forum.codeigniter.com/thread-77507.html) but did not find the answer. So I've decided do not load all translations in controller. I just output tr...
846 Views
5 Replies
11-16-2020, 07:20 AM
T.O.M.
    Thread: User switching locale
Post: RE: User switching locale

Yes, I faced the same problem until I looked to the source code (https://github.com/codeigniter4/CodeIgniter4/blob/develop/system/HTTP/IncomingRequest.php#L216) :)
1,314 Views
3 Replies
11-12-2020, 08:20 AM
T.O.M.
    Thread: User switching locale
Post: RE: User switching locale

You may use "$this->request->setLocale()" and "$this->request->getLocale()" methods to set and get locale from request and do not use URL segment - https://codeigniter.com/user_guide/outgoing/localiza...
1,314 Views
3 Replies
11-12-2020, 02:12 AM
T.O.M.
    Thread: How to call helper function from Controller's Constructor?
Post: RE: How to call helper function from Controller's ...

In BaseController constructor is initController() method (not __constructor()). So your __constructor() is called earlier then BaseController::initController() and helpers are not loaded yet. You can ...
1,346 Views
4 Replies
11-11-2020, 06:58 AM
T.O.M.
    Thread: How to call helper function from Controller's Constructor?
Post: RE: How to call helper function from Controller's ...

If you loaded your helper then you can call it's function only with name - thefunction();
1,346 Views
4 Replies
11-11-2020, 02:01 AM
T.O.M.
    Thread: Codeigniter 4 Load settings from database
Post: RE: Codeigniter 4 Load settings from database

You can create your own configuration file (https://codeigniter.com/user_guide/general/configuration.html#creating-configuration-files) and this file may contain any properties and methods as you want...
1,641 Views
5 Replies
11-04-2020, 12:27 AM
T.O.M.
    Thread: Codeigniter 4 development mode returning extra HTML
Post: RE: Codeigniter 4 development mode returning extra...

It is not necessary to switch to production environment. You can disable toolbar in development mode - just disable CI_DEBUG. In "/app/Config/Boot/development.php" change PHP Code: -- defined('CI...
1,921 Views
6 Replies
11-03-2020, 06:46 AM
T.O.M.
    Thread: configuration files as array?
Post: RE: configuration files as array?

config('Config\TestConfig') returns instance of Config class. You cannot convert it to array as you want. You may make your own array variable with needed keys and pass it to view call: PHP Code: --...
594 Views
2 Replies
10-22-2020, 06:52 AM
T.O.M.
    Thread: Best way to create a notifications system in nav bar
Post: RE: Best way to create a notifications system in n...

You can use notification library (instead of notification controller) and call it in page controller. Alternatively you can use View Cells (https://codeigniter.com/user_guide/outgoing/view_cells.html...
1,423 Views
6 Replies
10-21-2020, 06:16 AM
T.O.M.
    Thread: Form-Action Variables not working while routing
Post: RE: Form-Action Variables not working while routin...

You must set `method="post"` in your form. If it is not set, then form sends data with GET. And you are trying to get data from POST - $this->request->getPost("formfieldname")
887 Views
4 Replies
10-20-2020, 01:55 AM
T.O.M.
    Thread: You must use the "set" method to update an entry. (Again)
Post: RE: You must use the "set" method to update an ent...

Shouldn't $allowedFields be an array? PHP Code: -- protected $allowedFields = ['role_id', 'first_name', 'last_name', 'username', 'password', 'email_address', 'mail_me', 'ack_round', 'language', ...
2,480 Views
9 Replies
10-14-2020, 11:30 PM
T.O.M.
    Thread: Controller can't return json data
Post: RE: Controller can't return json data

Try to use this (according to documentation (https://codeigniter.com/user_guide/outgoing/response.html#setting-the-output)): PHP Code: -- return $this->response->setJSON($data); // $data - is arr...
1,580 Views
3 Replies
10-14-2020, 11:17 PM
T.O.M.
    Thread: Need help for complex query
Post: RE: Need help for complex query

It is not very nice way to store multiple values in one field - it is not convenient and not practical. You can modify your relationship table to store category IDs one per field, but on different ro...
807 Views
3 Replies
10-11-2020, 11:50 PM
T.O.M.
    Thread: Migrate to a certain file
Post: RE: Migrate to a certain file

I've also interested of this question and asked it here (https://forum.codeigniter.com/thread-77712.html) (didn't notice your post before). In CI3 it was very helpful. And it is not yet clear how to ...
710 Views
1 Replies
10-09-2020, 12:52 AM
T.O.M.
    Thread: Is it possible to run Database Migration to a specific version?
Post: Is it possible to run Database Migration to a spec...

In CI3 was ability to run Database Migration to a specific version with "version" method - docs (https://codeigniter.com/userguide3/libraries/migration.html#CI_Migration::version) This allowed both t...
450 Views
0 Replies
10-08-2020, 08:59 AM
T.O.M.
    Thread: Unable to connect to the database.
Post: RE: Unable to connect to the database.

Alternatively you can use "db_connect()" method to get connect to your database https://codeigniter.com/user_guide/database/connecting.html?highlight=db_connect BUT you shouldn't do it in Controlle...
505 Views
2 Replies
09-15-2020, 07:55 AM
T.O.M.
    Thread: logging all user actions
Post: RE: logging all user actions

Goddard Wrote: (09-01-2020, 01:11 PM) -- I am using CI 3.  I want to log all users insert, update, and delete to a specific table in my database.  Can I easily do this using MY_Model, or some other w...
7,142 Views
18 Replies
09-14-2020, 01:58 PM
T.O.M.
    Thread: Is it possible to move Config folder into root?
Post: RE: Is it possible to move Config folder into root...

MrWhite Wrote: (09-13-2020, 06:43 PM) -- But the problem is config options like supportedLocales, appTimezone are not available in the .env file. but only available in the App.php config file. -- W...
1,321 Views
6 Replies
09-14-2020, 01:20 PM
T.O.M.
    Thread: error when call JSON response
Post: RE: error when call JSON response

If you want to return JSON from your controller method you should set JSON to response and return it - https://codeigniter.com/user_guide/outgoing/response.html?highlight=setjson#setting-the-output ...
1,701 Views
2 Replies
09-10-2020, 11:15 PM
T.O.M.
    Thread: Is there ane way to get all language lines?
Post: Is there ane way to get all language lines?

In CI3 was ability to get all language lines as array with: PHP Code: -- $this->lang->language -- It is very useful for views - no need to list all the required language fields and just add all of...
456 Views
0 Replies
09-09-2020, 05:14 AM
T.O.M.

Theme © iAndrew 2016 - Forum software by © MyBB