View Full Version : Integrating a site statistics package
UweB
27th of July 2007 (Fri), 04:07
I installed a web vistor statistics package "phpTrafficA" on my webserver. I would like to build this into the EE2 pages but i have unfortunately not the slightest idea how this can be done.
The website for phpTrafficA is here: http://soft.zoneo.net/phpTrafficA/index.php?l=en
Here are instructions from Gallery, another Gallery Software, on how to embed website counters into the Gallery Code. Some of them are for phpTrafficA.
http://codex.gallery2.org/Gallery2:How_to_embed_counter_code_at_the_page_bot tom
Is it possible to have this on all of EE2 pages, somehow by way of putting this in a EE2 template?
The code to emmbed into the php pages according to the phpTrafficA author looks like this:
----
Image, with php:
Somewhere in your php code, include the following lines:
$referer = base64_encode($_SERVER["HTTP_REFERER"]);
$thispage = base64_encode($_SERVER["REQUEST_URI"]);
$id = "505049";
$time = time();
echo "<img src=\"http://www.borck.ch/directory/count.php?sid=$id&p=$thispage&r=$referer&t=$time\" alt=\"\">";
----
Pekka
4th of August 2007 (Sat), 06:13
How to add any custom code to templates:
Save it in e.g. templates/extra_components/ folder as "mycode.php"
Then add line
@include("./" ."templates/extra_components/mycode.php");
(you may need <?php ..... ?>)
in all content templates under templates/pages/ in position where you want the code to run and output. Validate the (x)html output.
UweB
5th of August 2007 (Sun), 14:22
Thank's a lot.... It works, almost, perfect ! Almost, means only that the image counter is now visible on the index page slightly disrupting the layout of EE2 which am not sure i like or not. On the other EE2 pages it looks OK.
What is the difference of the @ at the beginning on some include statements while others do not have it? I tried to do it with and without the @ but could not see any difference.
I made a check for valid xhtml and got some errors. The first couple of lines are all from the traffic counter. The ones for EE2 start at line 433. Some of them seem to come from descriptive text or names which use within EE2 while others i do not recognise at all.
The link for the results page is here: http://www.validome.org/validate/?uri=http://www.borck.ch/gallery/
With what i know of xhtml i do not see whether this list of errors is relevant or not for the inner workings of EE2 nor do i know how good Validome for this task is... learning never seems to have an end ;-)
Pekka
5th of August 2007 (Sun), 18:57
What is the difference of the @ at the beginning on some include statements while others do not have it? I tried to do it with and without the @ but could not see any difference.
The @ is error message suppression when the function fails. In this case if the files does not exist there would be no nasty PHP error printed.
I made a check for valid xhtml and got some errors. The first couple of lines are all from the traffic counter. The ones for EE2 start at line 433. Some of them seem to come from descriptive text or names which use within EE2 while others i do not recognise at all.
The link for the results page is here: http://www.validome.org/validate/?uri=http://www.borck.ch/gallery/
With what i know of xhtml i do not see whether this list of errors is relevant or not for the inner workings of EE2 nor do i know how good Validome for this task is... learning never seems to have an end ;-)
"Closing html-Tag not found, " means you lack </html> in the end of the document.
All & related errors in php parameter strings and other strings can be fixed by replacing & with &
"B&W" errors might be EE bug (not doing html entities for title, I'll add that to todo list)
<img> tags should be closed: <img src="" />
PS. you pages load faster if you put Javascript to the end.
vBulletin® v3.6.12, Copyright ©2000-2012, Jelsoft Enterprises Ltd.