Beispiel #1
0
 /**
  * Render PHP template for form object
  *
  * @param EasyForm $formObj
  * @param string $tplFile
  * @return string result of rendering process
  */
 protected static function renderPHP($formObj, $tplAttributes = array())
 {
     $form = TemplateHelper::getZendTemplate();
     $tplFile = TemplateHelper::getTplFileWithPath($formObj->templateFile, $formObj->package);
     $form->addScriptPath(dirname($tplFile));
     /* $formOutput = $formObj->outputAttrs();
        foreach ($formOutput as $k=>$v) {
        $form->$k = $v;
        } */
     foreach ($tplAttributes as $key => $value) {
         if ($value == NULL) {
             $form->{$key} = '';
         } else {
             $form->{$key} = $value;
         }
     }
     // render the formobj attributes
     //$form->form = $formOutput;
     return $form->render($formObj->templateFile);
 }
Beispiel #2
0
 /**
  * Render PHP template for view object
  *
  * @param EasyForm $formObj
  * @param string $tplFile
  * @return string result of rendering process
  */
 protected static function renderPHP($viewObj, $tplAttributes = array())
 {
     $view = TemplateHelper::getZendTemplate();
     $tplFile = TemplateHelper::getTplFileWithPath($viewObj->templateFile, $viewObj->package);
     $view->addScriptPath(dirname($tplFile));
     //Translate Array of template variables to \Zend template object
     foreach ($tplAttributes as $key => $value) {
         if ($value == NULL) {
             $view->{$key} = '';
         } else {
             $view->{$key} = $value;
         }
     }
     if ($viewObj->consoleOutput) {
         echo $view->render($viewObj->templateFile);
     } else {
         return $view->render($viewObj->templateFile);
     }
 }