In the main view i have this function
public function lang($file, $language){
require 'languages/'.$language.'/'. $file . '.php';
}
Then in the view file home.php i have
$this->lang('global','en');
The lag file global.php
$lang = array (
'title' => 'mySite',
);
Now in the home.php if I use print_r($lang); nothing happens. I copy and paste the same script below the array in global.php and in home.php I see the array. So the file is loaded but why can’t I use it home.php ?
I’d suggest caching the results, though, and accessing that way.