Вызов и отображение компонента в другом компоненте Joomla

Пример с источника:

// Path to the users component
$com = JPATH_SITE.DS.'components'.DS.'com_users';

// Get/configure the users controller
if (!class_exists('UsersController')) require($com.DS.'controller.php');
$config['base_path'] = $com;
$cont = new UsersController($config);

// Get the view and add the correct template path
$view =& $cont->getView('registration', 'html');
$view->addTemplatePath($com.DS.'views'.DS.'registration'.DS.'tmpl');

// Set which view to display and add appropriate paths
JRequest::setVar('view', 'registration');
JForm::addFormPath($com.DS.'models'.DS.'forms');
JForm::addFieldPath($com.DS.'models'.DS.'fields');

// Load the language file
$lang =& JFactory::getLanguage();
$lang->load('com_users', JPATH_SITE);

// And finally render the view!
$cont->display();

 

Своя адаптация:

// Вызываем com_finder для получения его результатов
$cpath = JPATH_SITE.'/components/com_finder';
if(!class_exists('FinderController')) require($cpath.'/controller.php');
if(!class_exists('JHtmlQuery')) require($cpath.'/helpers/html/query.php');
if(!class_exists('JHtmlFilter')) require($cpath.'/helpers/html/filter.php');
$config = array('base_path' => $cpath);
$ctrl = new FinderController($config);
$model = $ctrl->getModel('Search', 'FinderModel');
$view =& $ctrl->getView('search', 'html');
$view->addTemplatePath($cpath.'/views/search/tmpl');
$input->set('view', 'search');
$ctrl->display();