function jabRenderPartialView($file, &$model, $renderContext = "partial") { global $jab; // Include theme folder and shared view folders $oldpath = get_include_path(); set_include_path($jab['themeFolder'] . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR . $jab['jab_dir'] . "/shared_views"); if (substr($file, -4) == ".jab") { // Load jab file $view = jabLoadContent($file); if (isset($view['syntax'])) { $jab['syntax_language'] = $view['syntax']; } // Format content jabRequire("markdown"); $view['content'] = jabMarkdown($view['content']); } else { if (substr($file, -4) == ".php") { // Start buffering ob_start(); // Render it include $file; // Auto close markdown blocks while ($jab['markdown_depth'] > 0) { jabLeaveMarkdown(); } // Capture it $view['content'] = ob_get_contents(); // End buffering ob_end_clean(); } else { throw new Exception("Unknown view extension for view '" . $file . "'"); } } // Use a masterview? if ($view['masterview'] == "none") { // Just echo the content echo $view['content']; } else { // Default masterview? if (!isset($view['masterview'])) { $view['masterview'] = "master_view"; } // Include the masterview include $view['masterview'] . ".php"; } set_include_path($oldpath); }
function Format() { jabRequire("markdown"); return jabMarkdown($this->Content, !$this->ByAuthor); }
function jabLeaveMarkdown() { global $jab; if (--$jab['markdown_depth'] == 0) { // Format content $html = jabMarkdown(ob_get_contents(), $jab['markdown_safe']); ob_end_clean(); echo $html; } }