From 17566ac6f3581704c5238c433234ecfb7b0d98f2 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Wed, 22 Sep 2010 12:21:55 +0200 Subject: Add tpl_getLang function --- inc/template.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'inc/template.php') 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 * -- cgit v1.2.3