• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Writing Admin/User/Public controllers to insure authentication

#21
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.
Reply


Messages In This Thread
RE: Writing Admin/User/Public controllers to insure authentication - by mwhitney - 01-06-2015, 01:47 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.