File Includes- Design problems

P

Patrick

I have an ASP site with about 50 ASP files, all of which are currently
including a common "includes.asp" file near the top of the file, responsible
for generating the <HEAD/> section of the HTML

I need to make a change for 3 of those ASP files such that some dynamic HTML
is generated in the <HEAD/> section. I want those dynamic HTML to appear
only for 3 specific ASP files. Is there a more elegant way other than to
1) Dim strOptionalDymanmicHtml1 in includes.asp
2) Initialise strOptionalDymanmicHtml1 to "" in includes.asp
3) In the 3 ASP files which require additional optional dynamic HTML,
initiliase strOptionalDymanmicHtml1 *before* including includes.asp

There is an additional even more tricky problem, I have most file taking
this structure
ASPbeingView.asp including
- config.asp
- includes.asp

config.asp initialise a variable that is displayed in include.asp

However, there is one particular ASP file whose variable need to be
initialised in a different manner (within the ASPbeingView.asp). How could
I achieve this?

I have tried

1) Dim strDefault in config.asp
2) Initialise strDefault in config.asp
3) Dim strTemp in includes.asp
4) strTemp= strDefault in includes.asp
5) in the special ASP which need a different initialisation, I tried:
5.1) strTemp= "some other value",

but this doesn't work

Any thing other than making another copy of includes.asp and getting this
special ASP file to include this seperate includes.asp (which would make
includes.asp not very manageable- i would have to change includes.asp and
includesSpecial.asp for any future changes)!
 
A

Aaron Bertrand - MVP

Parse request.servervariables("script_name") ... this will have the
including file, not the included file. Then you can just do a conditional
based on that.
 
M

[MSFT]

Hi Patrick,

How about a session variant? You may set the session variant at the very
beginning of ASPbeingView.asp. And then, include includes.asp. In
includes.asp, you can control the output based on the session variant. Can
this help?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
A

Aaron Bertrand - MVP

You said you want includes.asp to be able to do something different when it
is in 2 or 3 ASP scripts, right?

So, in includes.asp:

<%
thispage = lcase(request.serverVariables("SCRIPT_NAME"))
if instr(thispage, "yourpage.asp")>0 then
' do something different
end if
%>

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,151
Messages
2,570,854
Members
47,395
Latest member
GennieGinn

Latest Threads

Top