Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class Autoloading?
#11
Did some more experimentation and you're right - you can simply use the autoloader off of the bat in the pluginname.php file.

PHP Code:
function my_autoloader($class) { ... }
spl_autoload_register('my_autoloader'); 

This works simultaneously for the front and back-end without the need for any hooks. When adding new classes, there is no longer a need to manage the series of includes lists (wherever they might be).

You've already solved it shawn; one less thing for you to think about :-P

Quote:loading a class does not execute anything does it?

In coding supplementary Matrix plugins, there was an issue on Ubuntu that plugins were loaded in reverse alphabetical order, so the order of the dependencies was completely buggered (e.g. Matrix CUsers initialization would take place before plain Matrix init) though again, I'm not sure if that also comes down to where/when certain plugin hooks were used). Most of that came down to the fact that those dependencies weren't loaded dynamically. This could solve those problems, though.
Reply


Messages In This Thread
Class Autoloading? - by Angryboy - 2014-03-14, 04:40:58
RE: Class Autoloading? - by shawn_a - 2014-03-14, 05:02:02
RE: Class Autoloading? - by Angryboy - 2014-03-14, 05:07:13
RE: Class Autoloading? - by shawn_a - 2014-03-14, 06:28:05
RE: Class Autoloading? - by Angryboy - 2014-03-14, 08:43:46
RE: Class Autoloading? - by shawn_a - 2014-03-14, 09:44:52
RE: Class Autoloading? - by Angryboy - 2014-03-14, 10:15:01
RE: Class Autoloading? - by shawn_a - 2014-03-14, 10:27:05
RE: Class Autoloading? - by shawn_a - 2014-03-14, 10:34:37
RE: Class Autoloading? - by shawn_a - 2014-03-14, 12:34:53
RE: Class Autoloading? - by Angryboy - 2014-03-14, 17:59:05



Users browsing this thread: 1 Guest(s)