[FIXED] can piwik move the one javascript script

(cn_Dark) #1


There is two hook useful when I write a plugion: template_js_import, template_css_import.

When I add a javascript for my plugin, the tag is add at the foot of , it is good.
But I find there is a at the beginning of .

<script ......></script>
<link .... />
<script type="text/javascript">
    var piwik = {};
    piwik.token_auth = "...";
    piwik.piwik_url = "http://localhost/piwik/";
    piwik.idSite = "1";    piwik.siteName = "...";    piwik.siteMainUrl = "...";    piwik.period = "day";    piwik.currentDateString = "2009-08-13";    piwik.minDateYear = 2009;    piwik.minDateMonth = parseInt("07", 10);    piwik.minDateDay = parseInt("24", 10);</script>

Some value such as piwik.minDateYear is useful. Is it possible to move this tag to ? Then I can use these values in my javascript of plugins.

(vipsoft) #2

Can you try moving the include in plugins/CoreHome/templates/index.tpl to see if that does what you want/need?

(cn_Dark) #3

Thank you very much, vipsoft.
I modify index.tpl and now it can work as I want.
change : line 13-> after line 8

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>Piwik &rsaquo; Web Analytics Reports</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Piwik {$piwik_version}" />
<link rel="shortcut icon" href="plugins/CoreHome/templates/images/favicon.ico"> 
{loadJavascriptTranslations plugins='CoreHome'}
{include file="CoreHome/templates/js_global_variables.tpl"}
{include file="CoreHome/templates/js_css_includes.tpl"}


{assign var=showSitesSelection value=true}

(cn_Dark) #4

Ignore this message, pls.
Sorry for my negligence. I have seen that it have been updated for this.

Hello vipsoft,
Could you modify this tpl when piwik update to a new version?
Maybe someone also need this feature style_emoticons/<#EMO_DIR#>/smile.gif