コード例 #1
0
 /**
  * Render body of a given element
  *
  * @return string
  * @throws Exception
  */
 public function renderBody()
 {
     $smarty =& Shade::getSmarty();
     $template = $smarty->createTemplate($this->getIndexFilePath());
     SmartyHelpers::setCurrentElement($this);
     if ($this instanceof Element) {
         SmartyHelpers::setCurrentProject($this->getProject());
     } elseif ($this instanceof Project) {
         SmartyHelpers::setCurrentProject($this);
     }
     $content = $template->fetch();
     SmartyHelpers::resetCurrentElementAndProject();
     $separator_pos = strpos($content, $this->properties_separator);
     if ($separator_pos === false) {
         if (substr($content, 0, 1) == '*') {
             $content = '*Content Not Provided*';
         }
     } else {
         $content = trim(substr($content, $separator_pos + strlen($this->properties_separator)));
     }
     return Shade::markdownToHtml($content);
 }