Visit or Contact Us | Jobs
A-Z Index
 Home   Future Students   Current Students   Faculty & Staff   Alumni & Friends   Visitors & Parents   

Faculty & Staff
Office of the President
Administration & Finance
Assessment, Institutional Research and Planning
· Auxiliary Services
Buildings & Grounds
Center for Teaching and Learning
Design & Construction
Human Resources
Lincoln University Senate
» OIT
· OIT Contact Us
· Service Request
Academic Computer Labs
· Residence Hall Network
· Residence Hall Telephones
· Student Technology Links
· OIT Help for Employees
· Helpful Links for LU Users
· Hints & Tips
Datatel Information
» Webmaster's Corner
· SiteBuilder Manual
» Creating a Counter
· Font Options
· Uploading Files
Print Shop
Purchasing
Staff Council
Telecommunications

 

Home » Faculty & Staff » OIT » Webmaster's Corner » Creating a Counter Sitemap

Creating a counter

Creating a counter is as easy as 1-2-3!

Step 1

You will need to know the page number of the page where the counter is to be displayed.  For example, to put a counter on THIS page, your page number would be 1485.asp.

Step 2

Paste the following CODE into your document where you want the page counter to appear.  Remember, you must paste it in CODE VIEW, not editing view.

The Code-- paste everything between the two lines
--------------------------------------------------------------

<P align=center><EM>You are visitor number <%
Dim fsoObject
Dim tsObject
Dim filObject
Dim lngVisitorNumber
Dim intWriteDigitLoopCount
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
Set filObject = fsoObject.GetFile(Server.MapPath("hitcounters/count000.txt"))
Set tsObject = filObject.OpenAsTextStream
lngVisitorNumber = CLng(tsObject.ReadAll)
lngVisitorNumber = lngVisitorNumber + 1
Set tsObject = fsoObject.CreateTextFile(Server.MapPath("hitcounters/count000.txt"))
tsObject.Write CStr(lngVisitorNumber)
Set fsoObject = Nothing
Set tsObject = Nothing
Set filObject = Nothing
Response.Write(lngVisitorNumber)
%>      since Month 00, 2000</EM></P>

--------------------------------------------------------------

Step 3

Edit the code to reflect YOUR counter file name.  You will  need to make THREE changes.

Change the MapPath to your counter number-- this will be the same as your page number.  For example:

change:  (Server.MapPath("hitcounters/count000.txt"))
To:        (Server.MapPath("hitcounters/count1485.txt")) [for this page]
    -- Do this in TWO places --

Next, change the 'since' date to the current month, day and year

 since Month 00, 2000  becomes   since December 06, 2006

------------------ Finished Result --------------------------------

You are visitor number 1192 since December 06, 2006

 

All content © Lincoln University http://www.lincolnu.edu
2008 All rights reserved.