Skip to main content
Participant
June 4, 2006
Question

Create Hit Counter

  • June 4, 2006
  • 3 replies
  • 601 views
Hi,
Can you write a hit counter into your coldFusionApplication like you can in PHP and ASP please? I can't find any indication that you can but it seems odd if you can't! I want to use my own graphics but I don't really want to have to incorporate asp into my ColdFusion Application in order to be able to do so.
Thanks a million!
AS
This topic has been closed for replies.

3 replies

BKBK
Community Expert
Community Expert
June 7, 2006
IS there anything like that for ColdFusion?
You could just translate the Webwizguide code into Coldfusion, with one modification. Instead of reading and writing to a text file, you instead read and write to a database table, as Dan Bracuk suggests.

Inspiring
June 4, 2006
quote:

Originally posted by: ItsAllCFToMe
Hi,
Can you write a hit counter into your coldFusionApplication like you can in PHP and ASP please? I can't find any indication that you can but it seems odd if you can't! I want to use my own graphics but I don't really want to have to incorporate asp into my ColdFusion Application in order to be able to do so.
Thanks a million!
AS

Put a numeric field in a table in a db somewhere. Increment it by one everytime your page loads. Instant hit counter.
Participant
June 6, 2006
HI - Well the ASP example I have used in the past was from this tutorial:

http://www.webwizguide.com/asp/tutorials/hit_counter_tutorial.asp

IS there anything like that for ColdFusion?
Thanks

(The incrementing number idea doesn't help mw with custom graphics which is what I'm trying to achieve) Thanks Anyway
tclaremont
Inspiring
June 6, 2006
Create a dedicated directory with nothing but your digit graphics, 1.jpg, 2.jpg, 3.jpg, etc.

Next, use the classic database approach to log and count your hits.

Count the number of digits in the count number, so you know how many times to perform the following steps.

Once you have determined the count number... say 8576, use string functions to fetch each individual digit.

#mid(countnumber,1,1).jpg# wil return 8.jpg
#mid(countnumber,2,1).jpg# wil return 5.jpg
#mid(countnumber,3,1).jpg# wil return 7.jpg
#mid(countnumber,4,1).jpg# wil return 6.jpg

Does this lead you in the right direction?


BKBK
Community Expert
Community Expert
June 4, 2006
like you can in PHP and ASP
Could you give examples of those, so we know where to look in CFMX?