Skip to main content
Minor improvements to English
Source Link
mickmackusa
  • 4.9k
  • 4
  • 20
  • 49

JLoader::import() is generally meant for files that follow a certain naming convention. You can still use it as it will fall back to to the specified filename, but you have to pass base paththe basepath as the second argument:

JLoader::import('components.com_nodice.models.widget', JPATH_ADMINISTRATOR); 

ButAlternatively, you could use JLoader::register() instead.:

JLoader::register('NoDiceModelWidget', JPATH_ADMINISTRATOR . '/components/com_nodice/models/widget.php'); 

JLoader::import() is generally meant for files that follow certain naming convention. You can still use it as it will fall back to to specified filename, but you have to pass base path as second argument:

JLoader::import('components.com_nodice.models.widget', JPATH_ADMINISTRATOR); 

But you could use JLoader::register() instead.

JLoader::register('NoDiceModelWidget', JPATH_ADMINISTRATOR . '/components/com_nodice/models/widget.php'); 

JLoader::import() is generally meant for files that follow a certain naming convention. You can still use it as it will fall back to the specified filename, but you have to pass the basepath as the second argument:

JLoader::import('components.com_nodice.models.widget', JPATH_ADMINISTRATOR); 

Alternatively, you could use JLoader::register():

JLoader::register('NoDiceModelWidget', JPATH_ADMINISTRATOR . '/components/com_nodice/models/widget.php'); 
Source Link
Sharky
  • 12.8k
  • 9
  • 24

JLoader::import() is generally meant for files that follow certain naming convention. You can still use it as it will fall back to to specified filename, but you have to pass base path as second argument:

JLoader::import('components.com_nodice.models.widget', JPATH_ADMINISTRATOR); 

But you could use JLoader::register() instead.

JLoader::register('NoDiceModelWidget', JPATH_ADMINISTRATOR . '/components/com_nodice/models/widget.php');