How to insert code into Smarty Template?


(tlombard) #1

How do I insert the javascript code into a smarty template?

I also want to eliminate MY IP address from being tracked:

$ipaddresses = ("##.#.###.###");
if (in_array($_SERVER[‘REMOTE_ADDR’], $ipaddresses)){

Piwik JavaScript

}

Thoughts?

-Tom


(tlombard) #2

actually…how does this look:


{php}
$ipaddresses = ("##.#.###.###");
if (in_array($_SERVER['REMOTE_ADDR'], $ipaddresses)){
{/php}
<!-- Piwik -->
{literal}
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "www.gunlistusa.com/analytics/" : "www.gunlistusa.com/analytics/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="www.gunlistusa.com/analytics/piwik.php?idsite=1" style="border:0" alt=""/></p></noscript>
<!-- End Piwik Tag -->
{/literal}
{php} }
{/php}