I have the following setup:
class.staff.php
This defines many variables, the one I'm working with right now is $thisuser->getStaffLang();
class.language.php
(Only a function, not a class) This file runs a sql query based on the one variable I pass it from header.inc.php as well as it should pull the staff members unique language ID.
The function is:
function translate($TRANSLATION){
$sql="SELECT $TRANSLATION FROM ".LANGUAGE_TABLE." WHERE LANGUAGE_ID=".$thisuser->getStaffLang;
$query = mysql_query($sql);
$translation = mysql_result($query,0);
print $translation;
}
header.inc.php
First file I'm working with using this function
example translation entry is:
translate('TEXT_WELCOME_BACK_STAFF');
My problem is that when I'm outside the function $thisuser->getStaffLang; is populated but inside the function it is empty. I really don't want to have to pass the same variable to the function over and over as some files can have upwards of 20 translations in them and that seems like alot of redundant coding. Can someone tell me how in the heck I can get that variable to be recognized by the function without have to pass it to it every single time when calling the function? Hope this wasn't clear as mud. :\
Note: Both class.language.php (where the function is and doesn't work) and header.inc.php (where the variable alone works) have required class.staff.php. So they both should be able to utilize that code/variable.