diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-09-22 18:00:19 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-09-22 18:00:19 -0700 |
commit | d5a13b1e4c0f35445aa539ff6b3779062907a9cb (patch) | |
tree | 1cc8fd26bb33981c2ab676a20aadec9d93b865ce /boot.php | |
parent | 124129e2a06a6ae82c283c8c10b7c3c7d0a0fdae (diff) | |
download | volse-hubzilla-d5a13b1e4c0f35445aa539ff6b3779062907a9cb.tar.gz volse-hubzilla-d5a13b1e4c0f35445aa539ff6b3779062907a9cb.tar.bz2 volse-hubzilla-d5a13b1e4c0f35445aa539ff6b3779062907a9cb.zip |
localisation path for all view templates
Diffstat (limited to 'boot.php')
-rw-r--r-- | boot.php | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -154,9 +154,8 @@ class App { } function init_pagehead() { - if(file_exists("view/head.tpl")) - $s = file_get_contents("view/head.tpl"); - $this->page['htmlhead'] = replace_macros($s,array( + $tpl = load_view_file("view/head.tpl"); + $this->page['htmlhead'] = replace_macros($tpl,array( '$baseurl' => $this->get_baseurl() )); } @@ -331,14 +330,14 @@ function escape_tags($string) { if(! function_exists('login')) { function login($register = false) { $o = ""; - $register_html = (($register) ? file_get_contents("view/register-link.tpl") : ""); + $register_html = (($register) ? load_view_file("view/register-link.tpl") : ""); if(x($_SESSION,'authenticated')) { - $o = file_get_contents("view/logout.tpl"); + $o = load_view_file("view/logout.tpl"); } else { - $o = file_get_contents("view/login.tpl"); + $o = load_view_file("view/login.tpl"); $o = replace_macros($o,array('$register_html' => $register_html )); } @@ -870,3 +869,12 @@ function format_like($cnt,$arr,$type,$id) { return $o; }} +if(! function_exists('load_view_file')) { +function load_view_file($s) { + $b = basename($s); + $d = dirname($s); + $lang = get_config('system','language'); + if($lang && file_exists("$d/$lang/$b")) + return file_get_contents("$d/$lang/$b"); + return file_get_contents($s); +}}
\ No newline at end of file |