// Get a model instance for the com_content component $model = JModelLegacy::getInstance('Articles', 'ContentModel');
// Get a model instance for the active component $app = JFactory::getApplication(); $component = $app->input->get('option', ''); $model = JModelLegacy::getInstance($component, 'ModelName');
// Get a model instance for an article with ID 42 $model = JModelLegacy::getInstance('Article', 'ContentModel'); $item = $model->getItem(42);In this example, we use the getInstance method to retrieve the Article model for the com_content component, then use the getItem method to retrieve the article with ID 42. Package Library: This also belongs to Joomla's core library.