diff options
-rw-r--r-- | inc/actions.php | 2 | ||||
-rw-r--r-- | inc/template.php | 15 | ||||
-rw-r--r-- | lib/exe/detail.php | 2 | ||||
-rw-r--r-- | lib/exe/media.php | 4 |
4 files changed, 19 insertions, 4 deletions
diff --git a/inc/actions.php b/inc/actions.php index a4e087f3a..f6c00f14a 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -74,7 +74,7 @@ function act_dispatch(){ //call template FIXME: all needed vars available? header('Content-Type: text/html; charset=utf-8'); - include(DOKU_INC.'lib/tpl/'.$conf['template'].'/main.php'); + include(template('main.php')); // output for the commands is now handled in inc/templates.php // in function tpl_content() } diff --git a/inc/template.php b/inc/template.php index 2d465e3d3..1d55ab102 100644 --- a/inc/template.php +++ b/inc/template.php @@ -32,6 +32,21 @@ function ptln($string,$intend=0){ } /** + * Returns the path to the given template, uses + * default one if the custom version doesn't exist + * + * @author Andreas Gohr <andi@splitbrain.org> + */ +function template($tpl){ + global $conf; + + if(@is_readable(DOKU_INC.'lib/tpl/'.$conf['template'].'/'.$tpl)) + return DOKU_INC.'lib/tpl/'.$conf['template'].'/'.$tpl; + + return DOKU_INC.'lib/tpl/default/'.$tpl; +} + +/** * Print the content * * This function is used for printing all the usual content diff --git a/lib/exe/detail.php b/lib/exe/detail.php index 1c676323f..6e2ae96c6 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -39,7 +39,7 @@ //start output and load template header('Content-Type: text/html; charset=utf-8'); - include(DOKU_INC.'lib/tpl/'.$conf['template'].'/detail.php'); + include(template('detail.php')); //restore old umask umask($conf['oldumask']); diff --git a/lib/exe/media.php b/lib/exe/media.php index 14474cb0c..c8db37153 100644 --- a/lib/exe/media.php +++ b/lib/exe/media.php @@ -53,9 +53,9 @@ //start output and load template header('Content-Type: text/html; charset=utf-8'); if($conf['refshow'] && count($mediareferences)){ - include(DOKU_INC.'lib/tpl/'.$conf['template'].'/mediaref.php'); + include(template('mediaref.php')); }else{ - include(DOKU_INC.'lib/tpl/'.$conf['template'].'/media.php'); + include(template('media.php')); } //restore old umask |