10-27-2007, 09:49 PM
|
#5 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
I get the idea!
But I can't get it to work within my gallery class for some reason..
I do like you said:
PHP Code:
$lang = new language($language, 'languages/'); $lang->getLanguages(); $lang->getLanguage(); $language = $lang->phrases; $gallery->setLang($language);
PHP Code:
public function setLang($lang) { $this->currentLang = $lang; }
...
echo $this->currentLang['next_pic'];
But it's not working..
PHP Code:
class language { public $phrases = array(); private $languages = array(); private $path; private $standardLanguage; public function __construct($standard, $path) { $this->standardLanguage = $standard; $this->path = $path; } // Checks the path for available languages and puts them in an array. public function getLanguages() { if ($handle = opendir($this->path)) { while (false !== ($file = readdir($handle))) { if($file != "." && $file != "..") { $file = substr($file, 0, -4); $this->languages[] = $file; } } closedir($handle); } } public function getLanguage() { if($_GET['setlang']) { $language = $_GET['setlang']; $check = array_search($language, $this->languages); if($check !== false) { if($language == $this->standardLanguage) { setcookie('lang', '', time()-3600); } else { setcookie('lang', $language, time()+3600); } include($this->path .$language. '.php'); return true; } else { include($this->path .$this->standardLanguage. '.php'); return false; } } else { if(isset($_COOKIE['lang'])) { include($this->path .$_COOKIE['lang']. '.php'); } else { include($this->path .$this->standardLanguage. '.php'); } return true; } $this->phrases = $lang; } }
=///
|
|
|
|