コード例 #1
0
ファイル: system.php プロジェクト: JexyRu/Ksenmart
 public static function loadTemplate(array $vars, $view = 'catalog', $layout = 'default', $tmpl = 'item')
 {
     $option = JFactory::getApplication()->input->get('option', null, 'string');
     if (!is_object(self::$_template_controller)) {
         if ($option != 'com_ksenmart') {
             self::$_template_controller = self::getController($view);
         } else {
             self::$_template_controller = JControllerLegacy::getInstance('KsenMartController' . ucfirst($view));
         }
     }
     $view = self::$_template_controller->getView($view, 'html');
     $model = self::$_template_controller->getModel('catalog');
     $current_layout = $view->getLayout();
     $view->setLayout($layout);
     if (empty($layout)) {
         $view->setLayout($tmpl);
     }
     $view->setModel($model, true);
     foreach ($vars as $name => $var) {
         $view->assign($name, $var);
     }
     $view->addTemplatePath(JPATH_THEMES . '/' . JFactory::getApplication()->getTemplate() . '/html/com_ksenmart/' . $view->getName());
     $html = $view->loadTemplate($tmpl);
     $view->setLayout($current_layout);
     return $html;
 }