Problem je ta, da ja dodjem do vrednosti u tabeli iz gornjeg dela koda index.php, a niže u kodu, nema šanse!!
--> langSlo.php //to mi je fajl sa variablama i slovenskim prevodom
--> langSelector.inc.php //to mi je kontroler za izbiru jezika
--> index.php //stranica, na kojoj imam problem sa dostupanjem do vrednosti(nize u kodu)
langSlo.php
Code:
class langSlo
{
var $userInterface; //uporabniski vmesnik
//konstruktor
function langSlo()
{
/* [uporabniski vmesnik] */
$this->userInterface = array(
//navigacija
'ProfilPodjetja'=>'Profil podjetja',
'KdoSmo'=>'Kdo smo?',
'Mission'=>'Mission',
'KjeSmo'=>'Kako do nas?',
'Kontakt'=>'Kontakt');
}//end langSlo
}
class langSlo
{
var $userInterface; //uporabniski vmesnik
//konstruktor
function langSlo()
{
/* [uporabniski vmesnik] */
$this->userInterface = array(
//navigacija
'ProfilPodjetja'=>'Profil podjetja',
'KdoSmo'=>'Kdo smo?',
'Mission'=>'Mission',
'KjeSmo'=>'Kako do nas?',
'Kontakt'=>'Kontakt');
}//end langSlo
}
langSelector.inc.php
Code:
require_once('languageFiles/langSlo.php');
class langSelector
{
var $polje;
//konstruktor
function langSelector($getvars=NULL)
{
if(!isset($getvars['lang'])){$_GET['lang']=1;}
switch($getvars['lang']){
case 1:
$this->polje = &new langSlo();
break;
case 2:
$this->polje = &new langEng();
break;
default:
$this->polje = &new langSlo();
}
}
}
require_once('languageFiles/langSlo.php');
class langSelector
{
var $polje;
//konstruktor
function langSelector($getvars=NULL)
{
if(!isset($getvars['lang'])){$_GET['lang']=1;}
switch($getvars['lang']){
case 1:
$this->polje = &new langSlo();
break;
case 2:
$this->polje = &new langEng();
break;
default:
$this->polje = &new langSlo();
}
}
}
index.php
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Fideam</title>
<?php
require_once("includes/langSelector.inc.php");
$jezik = &new langSelector($_GET);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Fideam</title>
<?php
require_once("includes/langSelector.inc.php");
$jezik = &new langSelector($_GET);
?>
Malo nize u index.php dam poziv
Code:
<?php echo $jezik->polje->userInterface['ProfilPodjetja']; ?>
i radi. Kad to isto napravim još nize u istom kodu, znači index.php, ne dobijem ništa!<?php echo $jezik->polje->userInterface['ProfilPodjetja']; ?>
Trebalo bi da ga uključim u navigaciju, pa mi stvarno nije jasno!
Ako ja napravim sledeče, stvar funkcionira, ali mi je to podvajanje koda!
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Fideam</title>
<?php
require_once("includes/langSelector.inc.php");
$jezik = &new langSelector($_GET);
$proba = $jezik->polje->userInterface['KdoSmo']; //ZNAČI, DA NAJPRE DEFINIRAM VAR, PA JIH KASNIJE ZOVEM
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Fideam</title>
<?php
require_once("includes/langSelector.inc.php");
$jezik = &new langSelector($_GET);
$proba = $jezik->polje->userInterface['KdoSmo']; //ZNAČI, DA NAJPRE DEFINIRAM VAR, PA JIH KASNIJE ZOVEM
?>
Možda nešto sa referencama?
If we want to discover, we first have to be willing to get lost!