Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - New Page Counter
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

New Page Counter

 Post Reply Post Reply
Author
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Topic: New Page Counter
    Posted: 14 May 2003 at 11:48am

I decided to use one of Web Wiz Guide's page counters. I tried running it. I'm still having problems. Please look at the red line of code. I got an error message that says, "Type mismatch".

<html>
<head>
<title>Hit Counter</title>
</head>
<body bgcolor="white" text="black">
 
<%
'Dimension variables
Dim fsoObject                   'File System Object
Dim tsObject                    'Text Stream Object
Dim filObject                     'File Object
Dim lngVisitorNumber          'Holds the visitor number
Dim intWriteDigitLoopCount  'Loop counter to display the graphical hit count
Dim strPath

'Set connection details
    strPath = Server.MapPath(".")
    strPath = Replace(strPath,"html","database")


'Create a File System Object variable
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")

'Initialise a File Object with the path and name of text file to open
Set filObject = fsoObject.GetFile(StrPath("hit_count.txt"))

'Open the visitor counter text file
Set tsObject = filObject.OpenAsTextStream

'Read in the visitor number from the visitor counter file
lngVisitorNumber = CLng(tsObject.ReadAll)

'Create a new visitor counter text file over writing the previous one
Set tsObject = fsoObject.CreateTextFile(Server.MapPath("hit_count.txt"))
 
'Write the new visitor number to the text file
tsObject.Write CStr(lngVisitorNumber)

'Reset server objects
Set fsoObject = Nothing
Set tsObject = Nothing
Set filObject = Nothing

'Display the hit count as text
'Response.Write(lngVisitorNumber)
 
'Loop to display graphical digits
For intWriteDigitLoopCount = 1 to Len(lngVisitorNumber)

    'Display the graphical hit count
    Response.Write("<img src=""counter_images/")
    Response.Write(Mid(lngVisitorNumber, intWriteDigitLoopCount, 1) & ".gif""")
    Response.Write("alt=""" & Mid(lngVisitorNumber, intWriteDigitLoopCount, 1) & """>")

Next
%> 
 
</body>
</html>

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 2003 at 1:03pm

Set filObject = fsoObject.GetFile(StrPath("hit_count.txt"))

is looking for a function called "StrPath", which is not what it is.... hence the "type mismatch"

Error messages dont lie

Contribute to the working anarchy we fondly call the Internet
Back to Top
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 2003 at 6:35pm
How do I change that line of code?
Back to Top
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Posted: 15 May 2003 at 5:20pm

Can someone please help me with this line of code?

 

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 4:24am
yeah, learn the difference between string concatination and calling a function
Contribute to the working anarchy we fondly call the Internet
Back to Top
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote b_bonnett Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 4:33am
Replace 'strPath' with 'Server.MapPath'

Regards,
Blair
Webmaster, The Plane Gallery
Greetings From Christchurch
Back to Top
 Post Reply Post Reply

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.