53 } |
53 } |
54 |
54 |
55 public static function getTemplate($id, $parms) |
55 public static function getTemplate($id, $parms) |
56 { |
56 { |
57 global $db, $session, $paths, $template, $plugins; // Common objects |
57 global $db, $session, $paths, $template, $plugins; // Common objects |
58 if(!isset($paths->pages[$paths->nslist['Template'].$id])) |
58 if ( !isPage($paths->get_pathskey($id, 'Template')) ) |
59 { |
59 { |
60 return '[['.$paths->nslist['Template'].$id.']]'; |
60 return '[['.$paths->nslist['Template'].$id.']]'; |
61 } |
61 } |
62 if(isset($paths->template_cache[$id])) |
62 if(isset($paths->template_cache[$id])) |
63 { |
63 { |
64 $text = $paths->template_cache[$id]; |
64 $text = $paths->template_cache[$id]; |
65 } |
65 } |
66 else |
66 else |
67 { |
67 { |
68 $text = RenderMan::getPage($id, 'Template', 0, true, true, 0); |
68 $page = new PageProcessor($id, 'Template'); |
|
69 $text = $page->fetch_text(); |
69 $paths->template_cache[$id] = $text; |
70 $paths->template_cache[$id] = $text; |
70 } |
71 } |
71 |
72 |
72 $text = preg_replace('/<noinclude>(.*?)<\/noinclude>/is', '', $text); |
73 $text = preg_replace('/<noinclude>(.*?)<\/noinclude>/is', '', $text); |
73 $text = preg_replace('/<nodisplay>(.*?)<\/nodisplay>/is', '\\1', $text); |
74 $text = preg_replace('/<nodisplay>(.*?)<\/nodisplay>/is', '\\1', $text); |
93 |
94 |
94 public static function fetch_template_text($id) |
95 public static function fetch_template_text($id) |
95 { |
96 { |
96 global $db, $session, $paths, $template, $plugins; // Common objects |
97 global $db, $session, $paths, $template, $plugins; // Common objects |
97 $fetch_ns = 'Template'; |
98 $fetch_ns = 'Template'; |
98 if(!isset($paths->pages[$paths->nslist['Template'].$id])) |
99 if ( !isPage($paths->get_pathskey($id, 'Template')) ) |
99 { |
100 { |
100 // Transclusion of another page |
101 // Transclusion of another page |
101 // 1.1.5: Now You, Too, Can Be A Template, Even If You're Just A Plain Old Article! (TM) |
102 // 1.1.5: Now You, Too, Can Be A Template, Even If You're Just A Plain Old Article! (TM) |
102 $nssep = substr($paths->nslist['Special'], -1); |
103 $nssep = substr($paths->nslist['Special'], -1); |
103 $nslist = $paths->nslist; |
104 $nslist = $paths->nslist; |