Writing Admin/User/Public controllers to insure authentication |
To answer the question at the beginning of step 4 in your tutorial:
Quote:This one gave me a lot of trouble, not knowing where the problem was when I used the ‘composer_autoload’ parameter set to true in the config.php file (I still don’t know where the problem is… so please feel free to tell me). Line numbers below may be approximate, depending on changes over time, but I referenced https://github.com/bcit-ci/CodeIgniter/b...gniter.php In system/core/CodeIgniter.php your controller is probably loaded somewhere between lines 385 and 460. The check against the composer_autoload config value and the loading of the autoload file occurs after this, between lines 467 and 477. The controller isn't instantiated until line 494, but PHP tried to resolve the class name when the controller's file was loaded and couldn't, because Composer's autoloader wasn't available, yet. For most files, loading Composer at this point is fine. For your base controller, though, you have to load Composer earlier. |
Welcome Guest, Not a member yet? Register Sign In |