Hey guys,
I would like to offer my VA Site in multiple languages. I created a new LangData.class.php. Everything works fine, The function Lang($pilot) returns the array $lang. When I define on any template $lang = LangData::Lang($pilot); or inside the module $this->set('lang', LangData::Lang($pilot)); it works perfectly fine. But I want to make the variable $lang accesable globaly, without having to set the variable in all modules or templates. I tried to set the variable inside the layout.php, because it covers all templates as the top file, but in that way I can only echo the array inside layout.php.
I use simpilot 5.5.2
Here is my code for LangData.class.php:
<?php
/////////////////////////////////////////////////
/// Langugage Package by GermanExpress VA ///
/// Author germanexpressva.de ///
/// Packed at 06/08/2019 ///
/// Copyright (c) 2019, germanexpressva.de ///
/////////////////////////////////////////////////
class LangData extends CodonData {
public static function Lang($pilot) {
//GERMAN
if($pilot->lang == 'de') {
$lang = array(
'TEST_TITLE' => 'testtextde'
);
//ENGLISH AS STANDARD
} else {
$lang = array(
'TEST_TITLE' => 'testtexten'
);
};
return $lang;
}
}
?>
Thanks in advance,
Tolga