/**
  * Get partial
  * 
  * @param   string  $template   Template name or moduleName/templateName
  * @param   array   $vars       Template vars [optional]
  * @return  string  Rendered partial
  */
 public static function get($template, $vars = array())
 {
     if (false !== ($separator = strpos($template, '/'))) {
         $module = substr($template, 0, $separator);
         $action = '_' . substr($template, $separator + 1);
     } else {
         $module = sfContext::getInstance()->getActionStack()->getLastEntry()->getModuleName();
         $action = '_' . $template;
     }
     $view = new dinThemePartialView(sfContext::getInstance(), $module, $action, '');
     $view->setPartialVars($vars);
     return $view->render();
 }
Exemplo n.º 2
0
 /**
  * Rendering component
  * 
  * @param   string  $moduleName     Module name
  * @param   string  $componentName  Component name
  * @param   array   $params         Component params
  * @return  string  Rendered component content
  */
 public function renderComponent($moduleName, $componentName, $params)
 {
     $actionName = '_' . $componentName;
     $view = new dinThemePartialView($this->context, $moduleName, $actionName, '');
     $view->setPartialVars($params);
     if ($retval = $view->getCache()) {
         return $retval;
     }
     $allVars = $this->callComponent($moduleName, $componentName, $params);
     if (!is_null($allVars)) {
         // render
         $view->getAttributeHolder()->add($allVars);
         return $view->render();
     }
 }