Created
May 14, 2010 22:20
-
-
Save drslump/401754 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: include/template.php | |
=================================================================== | |
--- include/template.php (revision 1176) | |
+++ include/template.php (working copy) | |
@@ -256,3 +256,26 @@ | |
} | |
return $line; | |
} | |
+ | |
+ | |
+// renderTemplate | |
+// | |
+// Renders the templates for the given section | |
+ | |
+function renderTemplate($section) { | |
+ global $config, $rep, $vars, $listing, $lang; | |
+ | |
+ // Set the section in the templates variables | |
+ $vars['template'] = $section; | |
+ | |
+ // Check if we are using a php powered template or the standard one | |
+ $path = !empty($rep) ? $rep->getTemplatePath() : $config->getTemplatePath(); | |
+ $path = $path . 'template.php'; | |
+ if (is_readable($path)) { | |
+ include $path; | |
+ } else { | |
+ parseTemplate('header.tmpl'); | |
+ parseTemplate($section . '.tmpl'); | |
+ parseTemplate('footer.tmpl'); | |
+ } | |
+} | |
Index: revision.php | |
=================================================================== | |
--- revision.php (revision 1176) | |
+++ revision.php (working copy) | |
@@ -166,7 +166,4 @@ | |
header('HTTP/1.x 404 Not Found', true, 404); | |
} | |
-$vars['template'] = 'revision'; | |
-parseTemplate('header.tmpl'); | |
-parseTemplate('revision.tmpl'); | |
-parseTemplate('footer.tmpl'); | |
+renderTemplate('revision'); | |
Index: comp.php | |
=================================================================== | |
--- comp.php (revision 1176) | |
+++ comp.php (working copy) | |
@@ -416,7 +416,4 @@ | |
header('HTTP/1.x 404 Not Found', true, 404); | |
} | |
-$vars['template'] = 'compare'; | |
-parseTemplate('header.tmpl'); | |
-parseTemplate('compare.tmpl'); | |
-parseTemplate('footer.tmpl'); | |
+renderTemplate('compare'); | |
Index: index.php | |
=================================================================== | |
--- index.php (revision 1176) | |
+++ index.php (working copy) | |
@@ -86,7 +86,4 @@ | |
$vars['opentree'] = $config->openTree; | |
$vars['groupcount'] = $groupcount; // Indicates whether any groups were present. | |
-$vars['template'] = 'index'; | |
-parseTemplate('header.tmpl'); | |
-parseTemplate('index.tmpl'); | |
-parseTemplate('footer.tmpl'); | |
+renderTemplate('index'); | |
Index: diff.php | |
=================================================================== | |
--- diff.php (revision 1176) | |
+++ diff.php (working copy) | |
@@ -175,7 +175,4 @@ | |
header('HTTP/1.x 404 Not Found', true, 404); | |
} | |
-$vars['template'] = 'diff'; | |
-parseTemplate('header.tmpl'); | |
-parseTemplate('diff.tmpl'); | |
-parseTemplate('footer.tmpl'); | |
+renderTemplate('diff'); | |
Index: listing.php | |
=================================================================== | |
--- listing.php (revision 1176) | |
+++ listing.php (working copy) | |
@@ -327,7 +327,4 @@ | |
header('HTTP/1.x 404 Not Found', true, 404); | |
} | |
-$vars['template'] = 'directory'; | |
-parseTemplate('header.tmpl'); | |
-parseTemplate('directory.tmpl'); | |
-parseTemplate('footer.tmpl'); | |
+renderTemplate('directory'); | |
Index: blame.php | |
=================================================================== | |
--- blame.php (revision 1176) | |
+++ blame.php (working copy) | |
@@ -205,7 +205,4 @@ | |
header('HTTP/1.x 404 Not Found', true, 404); | |
} | |
-$vars['template'] = 'blame'; | |
-parseTemplate('header.tmpl'); | |
-parseTemplate('blame.tmpl'); | |
-parseTemplate('footer.tmpl'); | |
+renderTemplate('blame'); | |
Index: log.php | |
=================================================================== | |
--- log.php (revision 1176) | |
+++ log.php (working copy) | |
@@ -416,7 +416,4 @@ | |
header('HTTP/1.x 404 Not Found', true, 404); | |
} | |
-$vars['template'] = 'log'; | |
-parseTemplate('header.tmpl'); | |
-parseTemplate('log.tmpl'); | |
-parseTemplate('footer.tmpl'); | |
+renderTemplate('log'); | |
Index: filedetails.php | |
=================================================================== | |
--- filedetails.php (revision 1176) | |
+++ filedetails.php (working copy) | |
@@ -195,7 +195,4 @@ | |
// $listing is populated with file data when file.tmpl calls [websvn-getlisting] | |
-$vars['template'] = 'file'; | |
-parseTemplate('header.tmpl'); | |
-parseTemplate('file.tmpl'); | |
-parseTemplate('footer.tmpl'); | |
+renderTemplate('file'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment