Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Help with putting comma’s in hit counter
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Help with putting comma’s in hit counter

 Post Reply Post Reply Page  123>
Author
kasl_33 View Drop Down
Groupie
Groupie
Avatar

Joined: 15 June 2003
Location: United States
Status: Offline
Points: 86
Post Options Post Options   Thanks (0) Thanks(0)   Quote kasl_33 Quote  Post ReplyReply Direct Link To This Post Topic: Help with putting comma’s in hit counter
    Posted: 17 January 2005 at 9:22pm
I have a hit counter on my site (www.kistech.com) and have over 200000 hits.  I like how Web Wiz Guide has commas in the number of hits at the bottom of the page.

Can somebody tell me what code I would need to modify (and how it should be) from the tutorial at this link?


Edited by kasl_33 - 19 January 2005 at 9:11pm
www.kasl.info

The PHP/MySql Web Development site
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 17 January 2005 at 10:24pm
Use the FormatNumber function
Back to Top
kasl_33 View Drop Down
Groupie
Groupie
Avatar

Joined: 15 June 2003
Location: United States
Status: Offline
Points: 86
Post Options Post Options   Thanks (0) Thanks(0)   Quote kasl_33 Quote  Post ReplyReply Direct Link To This Post Posted: 17 January 2005 at 10:33pm
I am an asp noob... so I don't know what you mean - let alone where to put it.  If it is a quick mod, would you be willing to post the modifications?

Thanks in advance!
www.kasl.info

The PHP/MySql Web Development site
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 17 January 2005 at 11:30pm
Wherever you output the counter value ( I guess it is something like Response.Write(varcounter)  or something like that)
Write this as
Response.Write(FormatNumber(varcounter,0,True,False,True) )
The last true indicates that numbers are to be grouped based on the settings in the servers CP.
Back to Top
kasl_33 View Drop Down
Groupie
Groupie
Avatar

Joined: 15 June 2003
Location: United States
Status: Offline
Points: 86
Post Options Post Options   Thanks (0) Thanks(0)   Quote kasl_33 Quote  Post ReplyReply Direct Link To This Post Posted: 17 January 2005 at 11:37pm
Okay, I think we're getting somewhere, but, again, I am still an asp noob.

Here is the code.  Please copy it and mark the changes in red if you would :)


<%

' Every time we count a user we will put the
' latest count value in the session variable "TotalCount"
' If Session Variable TotalCount is empty
' that mean this user is new and session variable
' But if Session Variable already has the value
' Then we will not count this user again.

If IsEmpty(Session("TotalCount"))  Then
 Call CountThisUser
End If

' It is good practice to use Functions and Sub procedure
' Because all the variables being used in sub or function
' are automatically destroyed when Sub or Function finish
' processing the code.
' So you can use these Variables again in other functions
Sub CountThisUser()

 Dim objFSO            ' FileSystemObject
 Dim objTS             ' TextStreamObject
 
 Dim strFileName      ' Counter text File Name
 Dim intOldCount
 Dim intNewCount
 
 ' Specify the Text file to store count value
 ' Because We Set Create = True
 ' File will be Created if it does not exist
 
 strFileName = Server.MapPath("Counter.txt")
 
 Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
 
 If objFSO.FileExists(strFileName)  Then
  Set objTS = objFSO.OpenTextFile(strFileName, 1)
 Else
  Set objTS = objFSO.CreateTextFile(strFileName, True)
 End If
   
 If Not objTS.AtEndOfStream  Then
  intoldCount = objTS.ReadAll
 Else
  intoldCount = 0
 End If
 
 objTS.Close
  
 intNewCount = intOldCount + 1
  
 ' Store the value of intNewCount in Session Variable
 ' So you can use it on different pages
 Session("TotalCount")= intNewCount
  
 ' Write intNewCount value back to text file
 
 Set objTS = objFSO.CreateTextFile(strFileName, True)
 objTS.Write intNewCount
 
 objTS.Close
 
 Set objFSO = Nothing
 Set objTS = Nothing
End Sub
%>

www.kasl.info

The PHP/MySql Web Development site
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 18 January 2005 at 9:05pm
No red today, but add it at
objTS.Write intNewCount
doing the FormatDateTime(intNewCount,......)
Back to Top
kasl_33 View Drop Down
Groupie
Groupie
Avatar

Joined: 15 June 2003
Location: United States
Status: Offline
Points: 86
Post Options Post Options   Thanks (0) Thanks(0)   Quote kasl_33 Quote  Post ReplyReply Direct Link To This Post Posted: 19 January 2005 at 9:11pm
Originally posted by michael michael wrote:

No red today, but add it at
objTS.Write intNewCount
doing the FormatDateTime(intNewCount,......)


I'm not sure exactly what you mean... how would that look in the actual code?
www.kasl.info

The PHP/MySql Web Development site
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 19 January 2005 at 10:16pm

objTS.Write FormatNumber(intNewCount,0,True,False,True) )

Back to Top
 Post Reply Post Reply Page  123>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.