In order to solve an issue for the aJaxSearch snippet, I
need to solve the following issue :
I use this snippet :
<?php
$stripHTML = 1;
$stripSnip = 1;
$jsVars = <<<EOD
<script type="text/javascript">
<!--
stripHtml = $stripHTML;
stripSnip = $stripSnip;
-->
</script>
EOD;
$modx->regClientStartupScript($jsVars);
?>
with the following template :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=[(modx_charset)]" />
</head>
<body>
[!Test!]
</body>
</html>
My test document test has an empty content and is a non-cacheable page.
With this test context :
The source code of the
result (a blank page, but look at the source code) is :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">
<!--
stripHtml = 1;
stripSnip = 1;
-->
</script>
<script type="text/javascript">
<!--
stripHtml = 1;
stripSnip = 1;
-->
</script>
</head>
<body>
</body>
</html>
I get the javascript initialisation twice >:( with IE6 or FF2.0
How could avoid that ? Any ideas ? I would like just init javaScript variables
The use of modx->regClientStartupScript() seems worked correctly. Why i get Two call to this function ?
If i use [[Test]] instead of [!Test!] in the template, it’s ok, I get the variables initialisation only one time.

Thanks for your help or any suggestion for a workaround