I am making a module displaying google map and retrieving the data in the marker info box from database. It is a hotel booking website. The currency stored in the database is Hotel's default currency while my goal is to show currency according to user's location.
I am using geoplugin class but it stops working when I try to pass variable or try to set variable in the class. I fetched the currency code from the database and tried to pass as variable to set it as base currency but it didn't work.
$curr = "USD"; // say "USD" is fetched from database
class geoPlugin {
public $curr;
//the geoPlugin server
var $host = 'http://www.geoplugin.net/php.gp?ip={IP}&base_currency={CURRENCY}';
//the default base currency
var $currency = $curr;
or $currency = $this->curr;
I also tried to set the variable inside the class
class geoPlugin {
var $host = 'http://www.geoplugin.net/php.gp?ip={IP}&base_currency={CURRENCY}';
public $curren;
public function setVariableOne($curr) {
$this->$curren = $curr;
}
//the default base currency
var $currency = $curren;
and in index file
$geoplugin = new geoPlugin();
$geoplugin->setVariableOne('USD');