diff options
author | Andreas Gohr <andi@splitbrain.org> | 2005-07-29 18:30:01 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2005-07-29 18:30:01 +0200 |
commit | 5a8920295cb951493bf3aeae56a021204bfe6d36 (patch) | |
tree | e3f78d8491e3fb1340b5d2c7b295fa7ce2d04e04 | |
parent | 424c3c4f29261765eec496ad226297815d75f4c1 (diff) | |
download | rpg-5a8920295cb951493bf3aeae56a021204bfe6d36.tar.gz rpg-5a8920295cb951493bf3aeae56a021204bfe6d36.tar.bz2 |
fallback to default template if custom one is not available
darcs-hash:20050729163001-7ad00-24d0768ecd593ab85fda0e3c5fbdbec0e8ff3276.gz
-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 |