The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Autoload Classes
#1
I've implemented autoloading classes, drop your class file into classes folder and away you go, see gist below which has a readme.txt and class.autoloader.php, just put the class file into classes folder, open init and remove all classes called with require_once() and in their place require the class.autoloader.php file:
Code:
require_once ABS_TR_ROOT.TR_URL_ROOT.'users/classes/class.autoloader.php';

thats it, classes will be required only when they are needed, we have only one require rather than multiple reducing overhead.

try it out by placing
Code:
bold("<br><br> Hoorah my class is included !");
in the input class then visit a page with input fields, you'll see "Hoorah my class is included !" only where the input class is used.

https://gist.github.com/Firestorm-Graphi...5f7e5c8632

NOTE: chunk6.php is only for userspice installation files
  Reply


Messages In This Thread
Autoload Classes - by firestorm - 07-07-2017, 08:48 AM
Autoload Classes - by mudmin - 07-09-2017, 12:12 PM
Autoload Classes - by firestorm - 07-09-2017, 01:50 PM
Autoload Classes - by mudmin - 07-09-2017, 02:10 PM
Autoload Classes - by firestorm - 07-09-2017, 02:12 PM
Autoload Classes - by firestorm - 07-13-2017, 01:09 PM
Autoload Classes - by mudmin - 07-13-2017, 01:26 PM
Autoload Classes - by firestorm - 07-13-2017, 05:46 PM
Autoload Classes - by karsen - 07-15-2017, 03:17 PM
Autoload Classes - by mudmin - 07-15-2017, 03:25 PM
Autoload Classes - by firestorm - 07-15-2017, 04:19 PM
Autoload Classes - by firestorm - 07-16-2017, 09:23 AM
Autoload Classes - by mudmin - 08-05-2017, 05:07 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)