Add webcounter to PHP code

I recently needed to add my web stats counter (statcounter) to a bunch of PHP code. It was for a new web link directory I am setting up; but I know very little about coding and certainly couldn’t get my html code inserted into the PHP code.

Fortunately, I did a quick search and found that the simplest way to call HTML code into a PHP set of pages is by doing an ‘include’.

Ok here goes – whether your using statcounter or google analytics; you need to insert the following code into your main (generally index.php) of the site:

<?
include(“mycode.html”);
?>

Then, create (using notepad, then upload it)

mycode.html (in your hosting directory)

Now, simply create a html file in your website hosting directory called mycode.html and add in the statcounter or any HTML code you want. Its that simple!

Further references and details on doing this at the following websites:

(How to call HTML code into PHP websites)

http://www.vbulletin.com/forum/showthread.php?16662-How-to-call-php-in-html-page

Best of luck.

Buying Forum Backlinks Not Smart

Posted in General on Nov 15th, 2009, 8:12 am by admin   


No comments yet. Be the first.

Leave a reply

You must be logged in to post a comment.

 
Add webcounter to PHP code