I'm trying to use the Const statement to define a group of constants.
I would like different groups of constants, one for each language (such
as english, spanish, etc.)
Depending on a variable (cookie, querystring, etc.) I would like the
constants to be defined differently.
One thing I tried was:
--------------------------------------------------------
FILE: const_eng.asp
<%
Const Line1 = "This is Line 1"
Const Line2 = "This is Line 2"
%>
FILE: const_esp.asp
<%
Const Line1 = "Espanol Numero Uno"
Const Line2 = "Espanol Numero Dos"
%>
FILE: const_test.asp
<% If Request.QueryString("lang") = "esp" Then %>
<!--#include file="const_esp.asp"-->
<% Else %>
<!--#include file="const_eng.asp"-->
<% End If
Response.Write Line1 & "<br>"
Response.Write Line2 & "<br>"
%>
---------------------------------------------------------
This didn't work.
Next I tried:
---------------------------------------------------------
FILE: const_lang.asp
<%
If Request.QueryString("lang") = "esp" Then
Const Line1 = "Espanol Numero Uno"
Const Line2 = "Espanol Numero Dos"
Else
Const Line1 = "This is Line 1"
Const Line2 = "This is Line 2"
End If
%>
FILE: const_test.asp
<!--#include file="const_test.asp"-->
<%
Response.Write Line1 & "<br>"
Response.Write Line2 & "<br>"
%>
---------------------------------------------------------
That didn't work either. I kept getting errors about redifining
constants.
So how can I accomplish this in ASP/VBScript. In PHP this is extermely
simple and used all the time for multiple language sites such as
PHP-Nuke.
ASPFAQ.com's suggetion on reading the file into a variable doesn't seem
to apply to my usage of constants in this manner either.
--
[ Sugapablo ]
[ http://www.sugapablo.com <--music ]
[ http://www.sugapablo.net <--personal ]
[ su*******@12jabber.com <--jabber IM ]