473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Question on Const and If...Then statements

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 ]
Jul 19 '05 #1
0 1196

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Desmond Liu | last post by:
I've read articles like Scott Meyer's EC++ (Item 22) that advocate the use of references when passing parameters. I understand the reasoning behind using references--you avoid the cost of creating...
6
by: Jacek Dziedzic | last post by:
Hello! First of all please forgive me for not posting a compilable snippet, but rather a simplified piece of code with the unimportant details left out. Let's say I have two classes...
2
by: fb | last post by:
Hi everyone. I have the following code. It was a question out of C++ how to program. I get a warning about "possible unreachable code" in the RunCode() function, but I don't see any problem with...
35
by: David Cleaver | last post by:
Hello all, I was wondering if there were some sort of limitations on the "if" statement? I'm writing a program which needs to check a bunch of conditions all at the same time (basically). And...
20
by: Daniel | last post by:
I have the following three classes class A { public: virtual void f() = 0; }; class B: public A {
5
by: hn.ft.pris | last post by:
Hi: I'm a beginer of STL, and I'm wondering why none of below works: ######################################################################## .......... string str("string"); if ( str == "s" )...
1
by: alacrite | last post by:
I have a class that represents a record in a database table. class tableName { int col1; string col2; int col3; ... other fields and relevant operations }
6
by: Grey Alien | last post by:
I am baffled by this behaviour. I have a class A declared as follows: class A { public: A(); explicit A(const std::string& value); explicit A(const TimestampParam& value) ;
21
by: Chad | last post by:
At the following url http://c-faq.com/lib/qsort2.html, they have the following Q: Now I'm trying to sort an array of structures with qsort. My comparison function takes pointers to structures,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.