I am developing a "Customer Dashboard" component in Joomla 3.2.
I need to include multiple models of different other components that I have built. I tried to include setModel as per views in controller, here is my businessservices controller
class BusinessServicesControllerBusinessServices extends JControllerForm
{
public function display($cachable = false, $urlparams = false)
{
// set default view if not set
$input = JFactory::getApplication()->input;
$input->set('view', $input->getCmd('view', 'BusinessServices'));
$viewName = $this->input->get('view');
switch ($viewName)
{
case 'businessservices':
$viewLayout = $this->input->get('layout', 'default');
$view = $this->getView($viewName, $format, '', array('base_path' => $this->basePath, 'layout' => $viewLayout));
$view->setModel($this->getModel('businessservices'));
break;
case 'trademark':
$viewLayout = $this->input->get('layout', 'default');
$view = $this->getView($viewName, $format, '', array('base_path' => $this->basePath, 'layout' => $viewLayout));
$view->setModel($this->getModel('trademark'));
break;
}
// call parent behavior
parent::display($cachable);
}
}
also, I tried to include using:
JLoader::import('joomla.application.component.model');
JLoader::import( 'llp','components' . DS . 'com_llp_service' . DS . 'models' );
JLoader::import( 'opc','components' . DS . 'com_opc_services' . DS . 'models' );
and getting the model using getInstance method
$actionsModel = JModel::getInstance('trademark', 'BusinessServicesModel');
it is giving some fatal error, that JModel::getInstance you can not use,
so I want know some proper way to doing this task, including all features to the customer dashboard.