Monday 17 August 2009 12:45:21 am
Hi, I created a templated opertor called in my pagelayout.tpl (who generate a javascript code for tracking). When I log when my template operator is call (eZLog::write), i saw 2-5 new lines each time i reload the page... My template operator is call only once in my footer... I done mu test from http://www.domaine.com/new_siteaccess The first time, the siteacces return by the function eZSys::indexFile() is the good one (new_siteaccess). But for the second, third,.. it return to me my defaut siteaccess... I dont understand. I try to set cookie (with the current siteaccess) before return my js code, but he always return the default.. Someone have a idea to this problem ? Code malformed ? eZ Bug ? PS: Sorry for my english Code:
<?php
class test
{
function test()
{
}
function operatorList()
{
return array(
'my_template_operator'
);
}
function namedParameterPerOperator()
{
return array(
'my_template_operator'=> array( 'url' )
);
}
function namedParameterList()
{
return array(
'my_template_operator' => array( 'params'=> array ())
);
}
function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters )
{
//parameters initialization
$arrParemeters = $this->namedParameterList();
foreach ($arrParemeters[$operatorName] as $strNameVar => $arrVal) {
if (isset($namedParameters[$strNameVar])) {
$$strNameVar = $namedParameters[$strNameVar];
} else {
$$strNameVar = $arrVal['default'];
}
}
switch ( $operatorName )
{
case 'my_template_operator':
{
$operatorValue = $this->my_template_operator($params);
break;
}
}
}
function my_template_operator()
{
eZLog::write("Siteaccess: " . eZSys::indexFile(), "test.log");
$sCode = "<script language=\"javascript\" type=\"text/javascript\">
//<![CDATA[
*******
//]]>>
</script>";
return $sCode;
}
}
?>
Log results:
Siteaccess: new_siteaccess
Siteaccess: defaut_siteaccess Siteaccess: defaut_siteaccess
|