coldfusion request scope

Panos used Ask the Experts™
Hello experts.
I need your knowledge about using the request scope in the following case.
I build a multilanguage website. I store the word-text files in my db .
To avoid several db calls i create  cfm pages like:
f.e text_EN.cfm page, and use the cficlude tag .
<cfset request.text_1 = "Hallo">
<cfset request.text_2 = "Welcome back user">
and get the values :#request.text_1#
1) Is this the right way?
2)Does the size of the request values in the cfm pages have any negative consequences?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
It's a little unclear on exactly how you're using the request fields.    Where do you define the request variables?   Are they used on many pages?

Request scope is used for global variables, define them in the application.cfc and use them anywhere.  But they disappear at the end of the request.

Session variable exists by user and last between page calls.

But!  Don't be afraid of performing a query, they only take a nano-second to run.  You can have 30 or more queries on a page run in less than a fraction of a second.


Hi gdemaria.
....It's a little unclear on......
I'm still using a application.cfm (the next step is to use application.cfc page).
I use there :
<cfinclude template="../config/text_#language#.cfm">
( i get the #language# value checking for a cookie or a form value.)

The text_#language#.cfm file has about 500 cfset tags for all the necessary text values for the whole website. For  large text files i use a query.

......But!  Don't be afraid ...
hmmm... It is too late now for me to replace all the request with queries (the funny thing is that i was handling this with queries in the beginning but i saw some php test codes that they are using "language files" ,so i did change it)
>  has about 500 cfset tags for all the necessary text values for the whole website

I see now.

Hmmm, it's a shame that you have to do all that for every page request.  Ideally, I would only fetch the values you need for the page the user is viewing.  

But given the design you have, request variable sounds like the right scope.


Can you please explain the disadvantage having more request than needed?


thank you
regards panos

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial