macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Re: (beginner) Coldfusion: variable to change language

Subject: Re: (beginner) Coldfusion: variable to change language
From: "Jerrzzzz" <webforumsuser@xxxxxxxxxxxxxx>
Date: Thu, 31 Jul 2008 14:37:30 +0000 (UTC)
Newsgroups: macromedia.coldfusion.cfml_general_discussion

I should maybe describe the structure of the site more. In the application.cfm 
the code for both header and footer is included, while the main material 
between is retrieved from a database (so you can add/change pages etc). I 
figured I could just create another database for the swedish info-pages or 
something like that. But my problem right now was with the header.

 So, what I did was I created a variable with <cfset lang = "eng">, and for the 
header html I did a

 <cfif isdefined("lang") and lang eq "eng">
 header html here
 </cfif>

 <cfif isdefined("lang") and lang eq "swe">
 header html here (in swedish)
 </cfif>

 anyways, I see. I wasn't sure how the variable scopes worked. Thanks for the 
explanation!

 But.. ok, say my link on the page were: 

 <a href="application.cfm?language=eng">English</a> 

 and in application.cfm:

 <cfset variables.language = url.language>

 could I then use something like (further down in application.cfm):

 <cfif isdefined("lang") and lang eq "eng">
 header html here
 </cfif>

 how do i then specify the initial value for "lang" ? I.e. the language I want 
people to see at once when opening the page.


<Prev in Thread] Current Thread [Next in Thread>