Tuesday, July 28, 2009

Is there any way to code a site hit counter without changing my entire page to php?

I have a php counter, but that means I have to make my whole page a php document. Is there a way just to have a php area like at the bottom of my page that I want the counter on, if the rest is html?

Is there any way to code a site hit counter without changing my entire page to php?
Put an IFRAME on your static HTML page that displays the hit counter php page.





static.html:





%26lt;iframe src="hitcounter.php" width="300" height="300"%26gt;%26lt;!-- set your own sizes --%26gt;%26lt;/iframe%26gt;
Reply:Have you tried using some of the pre-coded MySpace counters? All you have to do is copy and paste the code into your current html code, perhaps at the bottom.
Reply:If you have any php code in your document, then the page has to end in .php (or any other php extension you have enabled) If you do not do this, then the php code will not be parsed by the server.





Know, however, that you could very easily change only 1 page to .php and add a small section of code on the bottom of that page.
Reply:well normally if you use any php in an html page you have to change the extension to php of that page. However if you are on a Linux based web server you can edit the.htaccess file to process the htm and html pages through the php processor and then you would not have to change the extension to have it work.





Another way to do it is to get a different counter that is not written in php possibly one written in CGI would better suit you. Many web hosting providers offer free counters written in CGI as well.
Reply:Most servers can serve php within .html or .htm files. You may need to set a configuration to turn this on. Alternatively many will allow your index page to be index.php, if there is no index.html they will default to this. Once you determine which you want rename your index.html to index.php and put the counter code in the correct place on the page or just add the code to index.html.


To insert it :


%26lt;?php


your code here;


?%26gt;
Reply:if youre looking for a counter, theres amazingcounters.com. those are free to use and you can cuztomize them to fit your page. Mine is from there. hope that helps.








mike


http://mmendo.com

sim cards

No comments:

Post a Comment