PDA

View Full Version : include counter w/o php



ahni
03-23-2006, 11:55 AM
Hey. I'm wondering if it's possible to include this script without php; as, I use this php template script on my site and I can't seem to get php includes to work on my pages.

Thanks,

Ahni

Patrick
03-23-2006, 04:36 PM
Yes, this is possible by using javascript.

First, open up counter-display.html and replace its contents with:

document.write("<b>People Online:</b> !COUNTER-ONPAGE! <br>");
document.write("<b>Today's Visitors:</b> !COUNTER-TODAY! <br>");
document.write("<b>Total Visitors:</b> !COUNTER-VISITS! <br>");
document.write("<b>Total Hits:</b> !COUNTER-HITS!");

Then open up your templates, or where ever you add your custom code, and place the following in there:

<script type="text/javascript" src="/path/to/counter/counter.php"></script>

Where /path/to/counter/counter.php is your relative path (not absolute). For example, if counter.php were located at http://www.site.com/counter/counter.php, then it would look like:

<script type="text/javascript" src="/counter/counter.php"></script>

Fairly easy and simple ;)

ahni
11-02-2006, 01:37 PM
Ay! I completely forgot about this. Sorry for the severely delayed response Patiek.

Thanks for the help, it worked perfectly