Haslett, Andrew
andrew.haslett at ilc.gov.au
Mon Dec 22 17:29:01 CST 2003
Jim:
----
>> Here is some code that might help as it sets the ASP parser...
That's good practice, especially when you have little control of the web
server and its possible they may alter the default
'server-side-scripting-language'. It also allows multiple languages to be
used within an .asp page. (eg JScript etc.)
However it still won't be parsed by the asp engine unless the file has an
.asp extension (or one configured to be sent to the asp parser by the web
server).
Mark:
-----
>> If an .asp page can also satisfy that requirement then I will have the
best of both worlds...albeit against the corporate norm.
Yup go for it. If you change the extension of a html page to asp it will
work fine. All ASP pages do it convert any ASP code sections (as signified
above and in Jim's post) to HTML and output it to the browser.
Includes will work also, except that you have the added ability to include
asp files within your asp file. Note, that the syntax to include the file
*may* be slightly different (only going by memory), so the main thing to
remember is the SSI includes (what you are using now), are different that
ASP includes (what they become if you rename your .stm page to .asp), so a
quick search on the net will give you heaps of info and examples.
>>The purpose of this code was to add a hit counter for the calling page. I
am utilizing this code on each and every page. Is there a way to module-ize
this code into a separate file and pass in the calling page name?
At the top of each page, I would include a file one or more files, one of
which can be called 'utilities.asp'. This file contains a number of
functions that will hence be made available to all your calling pages, of
which one would handle your tracking.
Roughly:
*** utilities.asp ****
Function HitCounter(strPageName, strReferrer)
'Add hit to database using strPageName and strReferrer
'
End Function
*****************
**** index.asp ******
<!--#include file = "utilities.asp"-->
<%
dim bTrackMe 'as boolean
dim strThisPage 'as string
dim strReferrer 'as string
bTrackMe = True 'set to False if no tracking required
If bTrackMe then
strThisPage = request.servervariables("URL")
strReferrer = request.servervariables("HTTP_REFERER")
'Track this hit calling the function in utils file
Call HitCounter(strThisPage, strReferrer)
End If
<HTML>
<HEAD></HEAD>
<BODY> normal page stuff </BODY>
</HTML>
*********************
This is one method to track pages. You could actually move most of this
code into your utilities file itself if you wished but I thought it would be
easier to demonstrate this way.
Note that Utilities.asp does *not* need to have the asp extension (although
its safer as it can't be downloaded directly by users from the web like .inc
files can). Only the calling file does as this is the parser to be used for
all included files. This is because - all that the include does, is insert
the contents of the included file into the calling file and *THEN* processes
it, not before. This is why it's pointless to do conditional includes like
this:
<% if bla = "1" then %>
<!--#include file="file1.asp"-->
<% elseif bla = "2" then %>
<!--#include file="file2.asp"-->
<% end if %>
... because both files are included *before* the IF statement is processed.
Anyway, hope this helps!!!
Cheers,
Andrew
-----Original Message-----
From: Jim Lawrence (AccessD) [mailto:accessd at shaw.ca]
Sent: Tuesday, 23 December 2003 6:02 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] X-Posted: AccessD / dba-Tech : ASP
Hi Mark:
Here is some code that might help as it sets the ASP parcer. You probably
know this but sometimes the simplist things can be over-looked. code snippet
from web page example:
<code>
...
<% LANGUAGE="VBSCRIPT" %>
<!-- #INCLUDE FILE="../Counter.inc" -->
...
</code>
IMPORTANT - PLEASE READ ********************
This email and any files transmitted with it are confidential and may
contain information protected by law from disclosure.
If you have received this message in error, please notify the sender
immediately and delete this email from your system.
No warranty is given that this email or files, if attached to this
email, are free from computer viruses or other defects. They
are provided on the basis the user assumes all responsibility for
loss, damage or consequence resulting directly or indirectly from
their use, whether caused by the negligence of the sender or not.