Hello all,
I am having trouble with understanding using variables between classes.
pass class variables to a variables?
pass class variables to an included file?
How to pass or get the variable $analytics for this included file or to use it directly by placing the script in the index file?
In the ganalytics.php file is the script routine.
index.php
if ($this->tplparams['scripts'] != "deactivated") {
//elxisLoader::loadFile('/templates/oneweb/functions/ganalytics.php');
}
logic.php
class tploneweb {
private function getParams() {
$eModule = eFactory::getModule();
elxisLoader::loadFile('includes/libraries/elxis/parameters.class.php');
$xmlpath = ELXIS_PATH.'/templates/oneweb/oneweb.xml';
$tplparams = $this->getDBParams();
$params = new elxisParameters($tplparams, $xmlpath, 'template');
$this->tplparams['scripts'] = $params->get('scripts');
}
public function gAnalytics() {
$eDoc = eFactory::getDocument();
$elxis = eFactory::getElxis();
if ($this->tplparams['analytics'] != "UA-XXXXX-X") {
$analytics = $this->tplparams['analytics'];
echo $analytics;
}
}
}