Java script php web counter

Everything related to CCount PHP click counter
Post Reply
hutia
Posts: 4
Joined: Wed Jun 08, 2011 2:31 pm

Java script php web counter

Post by hutia »

Teh code is:

Code: Select all

<script language="Javascript" src="http://www.newtonmedical.co.uk/forum/counter.php?page=ourteam"><!--//--></script>
I have a folder with logs for each website, and the syntax is correct, so why doesn't it work? Any suggestions?
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Java script php web counter

Post by Klemen »

Works fine when I test it, the count is updated. You can check that by opening the counter directly:
http://www.newtonmedical.co.uk/forum/co ... ge=ourteam

For 100% valid code you should break the code in several lines or anything after // will be considered as a comment by Javascript. Try

Code: Select all

<script language="Javascript" src="http://www.newtonmedical.co.uk/forum/counter.php?page=ourteam"><!--
//-->
</script>
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
hutia
Posts: 4
Joined: Wed Jun 08, 2011 2:31 pm

Re: Java script php web counter

Post by hutia »

I put the counter scripts on "ourteam" and "links" pages, but it seems to work only when I actually click on the links to the counter.
Besides the script itself shouldn't be visible on the page, how to hide it?
I also tried your code break but it doesn't seem to make any difference.
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Java script php web counter

Post by Henrie »

The output in the page is :

Code: Select all

<p class='vspace'><script language="Javascript" src="<a class='urllink' href='http://www.newtonmedical.co.uk/forum/counter.php?page=ourteam' rel='nofollow'>http://www.newtonmedical.co.uk/forum/counter.php?page=ourteam</a>"><!--
//-->
</p>
<p class='vspace'></script>
</p>
My guess is you have edited the page with a wysiwyg page editor.
To insert the code please use the option to input html code directly so that no paragraphs are added and that < and > are not converted to < and >
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Java script php web counter

Post by Klemen »

Henrie is right, you need to paste the Javascript code as HTML source, not like normal text if you use a "wysiwyg" html editor.

You can also try this simple trick:
http://www.phpjunkyard.com/tutorials/cut-paste-code.php
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
hutia
Posts: 4
Joined: Wed Jun 08, 2011 2:31 pm

Re: Java script php web counter

Post by hutia »

How do I do exactly the third step?:
then open the HTML file in a plain text editor, like Notepad
Do I do it by right clicking "view source"? There isn't any option to edit it from there.
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Java script php web counter

Post by Henrie »

Opening in notepad is only possible if you have access to the files on the server (for example through ftp).

What software do you use to edit your webpage. Do you use a software installed on your local computer, or are you using a webbased editor?
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
hutia
Posts: 4
Joined: Wed Jun 08, 2011 2:31 pm

Re: Java script php web counter

Post by hutia »

I edit it on my computer, for example to edit a page with links I click:
http://www.newtonmedical.co.uk/index.php?n=Main.Links and I don't know what editor it is.
I also have an access to the server and all the files there, and I sometimes use ftp as well.
So should I edit a particular page on the server or via ftp?
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Java script php web counter

Post by Henrie »

I meant the program you are running in which you click that link? You can see it in the title-bar of the program window. Is it a webbrowser like Internet Explorer or Firefox, or maybe a local editor like Dreamweaver.

But if you use FTP as well, than copy the page in which you want to add the code to your computer using FTP. Than open the file with notepad and paste the code as described in the tutorial that Klemen linked. Than save the file and upload it to the server again.
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Post Reply