I have repeatedly posted on the phpDocumentor forum with no results. So I thought I'd try here.

I'm using PHPDocumentor version 1.4.0a2 and I've tried adding my google analytics javascript to some templates:

Converters/HTML/frames/templates/DOM/earthli/templates/blank.tpl
Converters/HTML/frames/templates/DOM/earthli/templates/footer.tpl
Converters/HTML/frames/templates/DOM/earthli/templates/left_frame.tpl
Converters/HTML/frames/templates/DOM/earthli/templates/top_frame.tpl

Basically all I did was add the google analytics javascript before the closing tag:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-11666955-1");
pageTracker._trackPageview();
} catch(err) {}</script>

When I run phpdocumentor I get an error.

Fatal error:  Smarty: [in footer.tpl line 13]: syntax error: invalid attribute name: 'pageTracker._trackPageview();' (Smarty_Compiler.class.php, line 1433) in /home/jaith/flashmog/public/phpdoc/phpDocumentor/Smarty-2.6.0/libs/Smarty_Compiler.class.php on line 2062

Can anyone tell me how to get around this? I'm guessing it's using smarty templates and there must be some way to add javascript to a smarty template, right?

    The problem was apparently caused by the fact that smarty templates interpret anything between curly braces as a var or smarty directive.

    I solved this problem by putting {literal} and {/literal} around my js code and it works great.

      Write a Reply...