Welcome Guest, Not a member yet? Register   Sign In
Search Results
    Thread: Loading helper before controller
Post: RE: Loading helper before controller

jreklund Wrote: (08-27-2020, 02:49 PM) -- PHP Code: --     public function __construct()     {         parent::__construct();     } -- This code are unnecessary, in case you are only doing ...
6,742 Views
11 Replies
08-27-2020, 02:59 PM
Cyto5
    Thread: Loading helper before controller
Post: RE: Loading helper before controller

jreklund Wrote: (08-27-2020, 01:27 PM) -- Don't know exactly why this is (haven't looked in the code itself), but you can use an initController method instead of __construct to do what you want. ...
6,742 Views
11 Replies
08-27-2020, 01:35 PM
Cyto5
    Thread: Loading helper before controller
Post: RE: Loading helper before controller

I want this but my Perm class uses a function in an auto-loaded helper file so this doesn't work. PHP Code: -- class AdminBaseController extends \App\Controllers\BaseController { public functio...
6,742 Views
11 Replies
08-27-2020, 01:18 PM
Cyto5
    Thread: Loading helper before controller
Post: Loading helper before controller

What is a good way to load a helper before the controllers run. I am trying to use a function in a helper file inside my controller __construct() function and I am autoloading them in the basecontroll...
6,742 Views
11 Replies
08-27-2020, 11:03 AM
Cyto5
    Thread: Why no "limit" to a model select/update?
Post: RE: Why no "limit" to a model select/update?

MGatner Wrote: (07-19-2020, 11:49 AM) -- No need for that! All the database engines I know handle that for you. If you lookup a primary or unique key it will stop upon finding it. Maybe some alternat...
2,540 Views
3 Replies
07-20-2020, 09:38 AM
Cyto5
    Thread: Route with optional parameter
Post: Route with optional parameter

Is there a way to get the route file to work without having to manually define all optional params as separate routes? For example I have a logout route that normally is just "/logout" but I ha...
14,180 Views
5 Replies
07-17-2020, 10:52 AM
Cyto5
    Thread: is routes goes as redirection
Post: RE: is routes goes as redirection

A route isn't a redirect a route is just mapping a url to a controller/function. Route's tell CI what code needs to run for the url you are on. You would need to elaborate on the question more if that...
1,387 Views
2 Replies
07-15-2020, 02:16 PM
Cyto5
    Thread: CI4 Best way to ignore specific url in $_SESSION['_ci_previous_url'
Post: RE: CI4 Best way to ignore specific url in $_SESSI...

Digging into the issue further it looks like the javascript sendBeacon get's counted correctly as ajax when it does a POST but every so often the browser is sending  GET request at the same time from ...
1,288 Views
1 Replies
07-15-2020, 11:23 AM
Cyto5
    Thread: CI4 Best way to ignore specific url in $_SESSION['_ci_previous_url'
Post: CI4 Best way to ignore specific url in $_SESSION['...

What is the best way to ignore specific url's from getting added to $_SESSION['_ci_previous_url']. I have a automatic ajax timer logging a users activity and it doesn't get recorded when it goes throu...
1,288 Views
1 Replies
07-14-2020, 04:37 PM
Cyto5
    Thread: Why no "limit" to a model select/update?
Post: Why no "limit" to a model select/update?

When using a model such as $model->find(1) or $model->update(1,[values]) Why does it not automatically apply a LIMIT 1 in the query? If I am accessing a table with millions of records wouldn't ...
2,540 Views
3 Replies
07-10-2020, 01:27 PM
Cyto5
    Thread: Codeigniter-4 redirect back and ajax issue
Post: RE: Codeigniter-4 redirect back and ajax issue

Thank you, it seems that when i did my composer update it didn\t actually update my files past 4.0 and it said there were no updateds found but when I downloaded the latest code copied the new files ...
2,440 Views
3 Replies
07-05-2020, 03:28 PM
Cyto5
    Thread: Codeigniter-4 redirect back and ajax issue
Post: Codeigniter-4 redirect back and ajax issue

Does anyone have a suggestion on how to fix this issue without manually modifying CI core code. CI4 saves a reference to the last requested url so it can do it's redirect()->back() function however...
2,440 Views
3 Replies
07-02-2020, 02:46 PM
Cyto5
    Thread: Database connection in static method
Post: RE: Database connection in static method

So far the best solution I could find is: https://stackoverflow.com/questions/3312806/static-class-initializer-in-php/3312881#3312881 PHP Code: -- // file Foo.php class Foo {   protected stat...
1,973 Views
1 Replies
06-27-2020, 09:19 PM
Cyto5
    Thread: Database connection in static method
Post: Database connection in static method

In CI4, how would you create a static variable holding the $db connection to use inside of static methods? Everything I have tried either brings it only as a non-static var or doesn't seem to work. I ...
1,973 Views
1 Replies
06-26-2020, 04:43 PM
Cyto5

Theme © iAndrew 2016 - Forum software by © MyBB