diff options
-rw-r--r-- | inc/template.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/inc/template.php b/inc/template.php index 3d1135479..f7c104cdb 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1017,7 +1017,7 @@ function tpl_indexerWebBug(){ */ function tpl_getConf($id){ global $conf; - global $tpl_configloaded; + static $tpl_configloaded = false; $tpl = $conf['template']; @@ -1053,6 +1053,29 @@ function tpl_loadConfig(){ return $conf; } +// language methods +/** + * tpl_getLang($id) + * + * use this function to access template language variables + */ +function tpl_getLang($id){ + static $lang = array(); + + if (count($lang) === 0){ + $path = DOKU_TPLINC.'lang/'; + + $lang = array(); + + global $conf; // definitely don't invoke "global $lang" + // don't include once + @include($path.'en/lang.php'); + if ($conf['lang'] != 'en') @include($path.$conf['lang'].'/lang.php'); + } + + return $lang[$id]; +} + /** * prints the "main content" in the mediamanger popup * |