JLoader::register('TestHelper','/path/to/test.php'); dosen't load file, it just registers it to be able to autoload file if class is instantiated.
Do require it instantly, you want to use:
Note: for this your file name should be
include_once the file if it exists (with
require_once you would get PHP error, if it dosen't exist. Now you would get pretty Joomla! error).
Will remember that this file is already loaded and wont
include_once it again. This results in minor performance gain.
JLoader::register() your class, so you can't use
All in all:
- Minor performance gain.
- It's good practice to follow coding style of framework (though Joomla! dosen't do it everywhere itself).
- You can use dot notation for class name (not applicable for
Dot notation example
include_once file in