protected function _renderTemplate($tools)
 {
     $template_file = $this->template_id . '.phtml';
     $path = $tools->locateTemplateByAlias('_mail/' . $template_file);
     $template = new lmbMacroTemplate($path, $tools->getConf('macro'));
     $template->setVars($this->dataset->export());
     return $template->render();
 }
 function wrapTemplate($file, $slots_handlers)
 {
     $template = new lmbMacroTemplate($file, $this->__config);
     $template->setVars(get_object_vars($this));
     //global template vars
     foreach ($slots_handlers as $name => $handlers) {
         $template->set('__slot_handlers_' . $name, $handlers);
     }
     $template->setChildExecutor($this);
     //from now we consider the wrapper to be a master variable context
     echo $template->render();
 }
 protected function _parseMailTemplate($postfix = '')
 {
     $tools = lmbToolkit::instance();
     $template_file = $this->template_id . $postfix . '.phtml';
     $path = $tools->locateTemplateByAlias('_mail/' . $template_file);
     $template = new lmbMacroTemplate($path, $tools->getConf('macro'));
     $template->setVars($this->dto->export());
     $raw_content = $template->render();
     $parts = explode($this->separator, $raw_content);
     if (1 === count($parts)) {
         throw new lmbException('Subject must be on the top of mail template separated by "' . $this->separator . '"');
     }
     $this->subject = $parts[0];
     $this->text_content = $parts[1];
     if (3 === count($parts)) {
         $this->html_content = $parts[2];
     } else {
         $this->html_content = $this->text_content;
     }
 }