summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Lang <lang@cosmocode.de>2010-09-22 12:21:55 +0200
committerAdrian Lang <lang@cosmocode.de>2010-09-22 12:24:06 +0200
commit17566ac6f3581704c5238c433234ecfb7b0d98f2 (patch)
tree94a917e19241577d14780541be86ddf1e3210f85
parente383b0045564ef3c8c909634f8228028602bd409 (diff)
downloadrpg-17566ac6f3581704c5238c433234ecfb7b0d98f2.tar.gz
rpg-17566ac6f3581704c5238c433234ecfb7b0d98f2.tar.bz2
Add tpl_getLang function
-rw-r--r--inc/template.php25
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
*