from the presentation. For example, if you placed all of your content into
a struct (perhaps from a database) you could just output the same thing.
Something like this:
<!--- Set up the structs --->
<cfset PageContent = StructNew()>
<cfset PageContent.English = StructNew()>
<cfset PageContent.French = StructNew()>
<!--- Set up the English--->
<cfset PageContent.English.Phrase1 = �This phrase one in English�>
<cfset PageContent.English.Phrase2 = �This phrase two in English�>
<cfset PageContent.English.Phrase3 = �This phrase three in English�>
<!--- Set up the French� in English since I don�t speak French
--->
<cfset PageContent.English.Phrase1 = �This phrase one in French�>
<cfset PageContent.English.Phrase2 = �This phrase two in French�>
<cfset PageContent.English.Phrase3 = �This phrase three in French�>
<!--- Now you can do your table like this --->
<cfset CurrentLanguage = �English�>
<cfoutput>
<table>
<tr><td>#PageContent[CurrentLanguage].Phrase1#</td></tr>
<tr><td>#PageContent[CurrentLanguage].Phrase2#</td></tr>
<tr><td>#PageContent[CurrentLanguage].Phrase3#</td></tr>
</table>
</cfoutput>
Changing �CurrentLanguage� changes the content immediately � no ors, buts or
<cfif>s.
Of course this means that you�ll be doing a lot of structure setting � but
then your content is completely separate. If you need to add another
language, for example, you can just by changing the content files.
Jim Davis
_____
From: Mickael [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 17, 2003 9:38 AM
To: CF-Talk
Subject: Best Practices
Hello All,
I have an app that seem to run very slow at time, I am looking for ways that
I may not be using CF efficiently.
The app is in french and english, and is able user is able to switch back
and forth from french to english. I use a session variable for this.
My code states is <cfif session.language eq 1>english text<cfelse>french
text</cfif>
Here a piece of table
<table border="1" cellspacing="0" cellpadding="1" bordercolor="000066"
align="center">
<tr>
<td><cfif session.language eq 1>Issue #<cfelse>Demande #</cfif></td>
<td><cfif session.language eq 1>User ID<cfelse>Identification de
l'usager</cfif></td>
<td><cfif session.language eq 1>Date Logged<cfelse>Date
d'entrée</cfif></td>
My question is, is is better to Have the whole english table under the first
if statement then then entire french table in else faster than what I am
doing above. I like the method above because I have essentially only one
table to view the other way I would have two.
I am looking for suggestion on how to optimize this.
Thanks
Mike
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

