Installed Piwik 0.2.28 and it ran perfect. Good work. Now i’m trying to get the javascript running on a PHP Fusion V7 (Version 7.00.4) based website. When i put it in the same place as google analytics (/includes/footer_includes.php) it will cause a corrupted website, that means that all panels with the exception of the News Panel are disappearing or i get white page without any source code.
I coded it the same way like google analytics (which can run w/o problems):
[b]echo ' .... javascript code .... ';[/b]
Also tried with a " instead a ’ but this will give the same result. Also tried on other places, like the footer.php of the theme but either it will not appear or the design is corrupted. Do you have a idea what can be wrong ?
If you do not know PHP Fusion, here the link to the main website in UK: www.php-fusion.co.uk/
Searched the forum there but there’s no thread dealing with Piwik. Also tested with PHP Fusion V6 and got the same problems.
Forgive me if I have misunderstood. I am not sure why you have the “echo” statement there at all. I use modx as a CMS and I just enter the code into the footer exactly as follows:
If you really have to have it within an echo statement then you will need to use escape characters before specific characters in the piwik code. Addslashes is your friend. Have a look here for details:
MODx seems to work with HTML at this point, so there is no need for a echo statemant. Fusion works pure with PHP and so when calling a script, there is a need for a echo.
I also think that it deals with the escape sequences and normally a change from " to ’ solves problems. So i could get the google analytics code work. In this case not. Addslash is only needed when you write to database. In this case we want to execute HTML and Javascript from a PHP file.
So the question is how to code the echo to make it work. Tried to put the code into a separate PHP File which i just included using require, but this produces the same effect.
Also tried simply to put the code into a panel, but this resulted in nothing. The panel is not visible (i made sure that it is active) and looking on the page source PHP creates i cannot see the Piwik code and the page is looking normal. When i do not see the Piwik code in the page source it will not executed and so nothing is counted.
Sorry, without using PHP Fusion, I am not able to go further. All I would say is that the PHP function addslashes is used any time you need a string outputted with correct escape characters - not just for writing to a database. I have used it many times for this reason.
within the /includes/footer_includes.php ( which the normal place reserved especially for such a code) produces the same result: Corrupted theme. Same happens when i pack the Piwik code into a variable and code the echo like this:
echo addslashes ($analytics);
I have a feeling that the code itself conflicts with PHP Fusion Coding, but i wonder why. Cannot see anything unsusual. Normally i have no problem executing javascripts within Fusion using the normal echo ’ … ’ ); . The Amazon scripts are working, Google Analytics is working, other AD-scripts are working … The Piwik script is the first one which caused problems.
[b]**** UPDATE: I think i got it. ****[/b]
The code which seems to work is:
?>
.... The Piwik code here ....
<PHP
I put it in the /includes/footer_includes.php. The page is not corrupted and now i can see the Piwik Code in the page source and so i assume that monitoring will work now.