diff -r c690f0b39bcb -r f1ed3e9298ae includes/render.php --- a/includes/render.php Sat Sep 15 13:16:13 2012 -0400 +++ b/includes/render.php Sat Sep 15 13:18:01 2012 -0400 @@ -45,7 +45,14 @@ $text = $page->fetch_text(); if ( !$render ) + { + $code = $plugins->setHook('render_getpage_norender'); + foreach ( $code as $cmd ) + { + eval($cmd); + } return $text; + } $text = self::render($text, $wiki, $smilies, $filter_links); return $text; @@ -54,10 +61,14 @@ public static function getTemplate($id, $parms) { global $db, $session, $paths, $template, $plugins; // Common objects + + // Verify target exists -- if not, double-bracket it to convert it to a redlink if ( !isPage($paths->get_pathskey($id, 'Template')) ) { return '[['.$paths->nslist['Template'].$id.']]'; } + + // fetch from DB or template cache if(isset($paths->template_cache[$id])) { $text = $paths->template_cache[$id]; @@ -69,6 +80,8 @@ $paths->template_cache[$id] = $text; } + // noinclude is not shown within the included template, only on the template's page when you load it + // nodisplay is not shown on the template's page, only in the included template $text = preg_replace('/(.*?)<\/noinclude>/is', '', $text); $text = preg_replace('/(.*?)<\/nodisplay>/is', '\\1', $text); @@ -91,7 +104,7 @@ return $text; } - public static function fetch_template_text($id) + public static function fetch_template_text($id, $params) { global $db, $session, $paths, $template, $plugins; // Common objects $fetch_ns = 'Template'; @@ -131,6 +144,11 @@ return '[['.$paths->nslist['Template'].$id.']]'; } } + + $template->context_push(); + + $template->assign_vars($params); + if(isset($paths->template_cache[$id])) { $text = $paths->template_cache[$id]; @@ -141,6 +159,8 @@ $paths->template_cache[$id] = $text; } + $template->context_pop(); + if ( is_string($text) ) { $text = preg_replace('/(.*?)<\/noinclude>/is', '', $text); @@ -894,7 +914,7 @@ { $parms = Array(); } - if ( $tpl_code = RenderMan::fetch_template_text($matches[1][$i]) ) + if ( $tpl_code = RenderMan::fetch_template_text($matches[1][$i], $parms) ) { // Intelligent paragraphs. // If: