Assuming you are trying to call a model "Categories" (/components/com_mycomponent/models/categories.php) belonging to com_mycomponent (this can be called from either within or outside of the com_mycomponent):
jimport('joomla.application.component.model'); JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_mycomponent/models'); $categoriesModel = JModelLegacy::getInstance( 'Categories', 'MyComponentModel' );
Now you can call its methods, example:
$categoriesModel->getCategories();
No comments:
Post a Comment