Sometimes you may wish to reuse a certain function that resides in a model outside of your current scope. This helps you save time and reduce duplication. This can be achieved easily by adding the following codes.

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):

$categoriesModel = JModelLegacy::getInstance( 'Categories', 'MyComponentModel' );

Now you can call its methods, example:


To avoid spam, please login to leave a comment.

Cron Job Starts