$model = JModelLegacy::getInstance('ModelName', 'ComponentNameModel'); $model->addIncludePath(JPATH_SITE . '/components/com_componentname/models');
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_componentname/helpers');
JModelLegacy::addIncludePath(JPATH_LIBRARIES . '/componentname');In the above example, the library files are stored in the 'componentname' directory of the Joomla libraries. Package Library: The package library in the above examples can be determined from the path passed to the addIncludePath() method. In example 1, the package library is the component's models directory. In example 2, the package library is the component's helpers directory. In example 3, the package library is the Joomla libraries directory.