Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using include files

Status
Not open for further replies.

BuzzerTom

Technical User
Joined
Aug 20, 2003
Messages
35
Location
BE
Hi all,

I have a website in 2 languages. I made the whole website one time and I read all the text from an include. In that file I decare my variable each time and then give it its value. Now in all my ASP pages I wanted to use something like this:

<% If language = "Dutch" Then %>
<!-- #INCLUDE FILE="language_dutch.asp" -->
<% Else %>
<!-- #INCLUDE FILE="language_english.asp" -->
<% End If %>

Now when an asp page opens itself, I get an error message, variable already declared, because I declare the same values in both include files. It seems ASP checks the include files and doesn't pay any attention to the if statement. Is there a solution for this ? Or is the only solution to declare the variables only in one or a seperate include file ?

Thanx,
Buzzer
 
I see your only option is to declare them before the if statment. Also I would use a select statement rather then an if statement. Select Case is much faster.
<%
'## Dim varaibles here...
Select Case language
Case "dutch"
%>
<!-- #INCLUDE FILE="language_dutch.asp" -->
<% Case Else %>
<!-- #INCLUDE FILE="language_english.asp" -->
<% End Select %>


www.sitesd.com
ASP WEB DEVELOPMENT
 
Dont include files get processed before code?

- FateFirst
 
yes FateFirst.

www.sitesd.com
ASP WEB DEVELOPMENT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top