|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hit Counter Problem?
Hello
I am new to Web-Design. I want to make a hit counter for one particular page. I have code in one separate functions page, I then call this from the page I want to count:- <!--#include file="tools/functions.asp"--> <% Totaldownloads() %> This bit of code is then called:- <% Function Totaldownloads() Application("downloads")=Application("downloads")+1 Totaldownloads = CInt(Application("downloads")) End Function %> However it seems that this code runs by itself allway's updating by 1, even when the Function is not called? I have other functions with the one stated above which are included on other pages, again using:- <!--#include file="tools/functions.asp"--> Surely the code should only run when called, not just included? Can you please help? Thanks Gary. |
|
#2
|
|||
|
|||
|
I think that you are over complicating things. If there is only one page that is going to use this function and the only thing that you are doing in the function is incrementing the download counter then why have it a function anyway? Why not take the function out of your include file and on the page that you want to keep track of simply do:
PHP Code:
Also just note, the first time that the server is restarted either because its been updated, or crashed, your counter is going to go back to zero. perhaps you want to save it in a file somewhere (in which case you might want to ue a function) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Hit Counter Problem? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|