Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Re: cgi.SERVER_NAME vs SERVER_NAME

Guest
Mar 25, 2011 Mar 25, 2011

Is there a difference betweencgi.SERVER_NAME vs SERVER_NAME?

thanks!

902
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 25, 2011 Mar 25, 2011

CF is VERY flexible with its variable origin, for good and some time for bad (if u are not careful)

There for cgi.SERVER_NAME is the same as SERVER_NAME …

AS LONG as there is no other declared variable named SERVER_NAME

Same go for form/url variables

Look at the following example:

<!--- Define URL . INFO --->

<cfparam name="url.info" default="url.info">

<!--- DEFINE FORM . INFO --->

<cfparam name="form.info" default="form.info">

<cfoutput>

<!--- NOTICE THE OUT PUT IS OF THE URL . INFO  --->

info - #info#<BR />

<cfset info = "I just added a value ">

<!--- NOW THE VALUE IS OF THE VARIABLE WE SET  --->

info - #info#<BR />

<!--- SAME GOES FOR SERVER_NAME --->

cgi.SERVER_NAME - #cgi.SERVER_NAME#<BR />

SERVER_NAME - #SERVER_NAME#<BR />

<cfset SERVER_NAME = "I just placed a new value ...">

SERVER_NAME - #SERVER_NAME#<BR />

</cfoutput>

Here is a good list of the order :

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec09af4-7fdf.html...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 26, 2011 Mar 26, 2011
LATEST

talofer99 gave you a reference to the order in which CF looks for scopes when you don't scope your variables.  While this allows you to be lazy with your typing, it will slow down your app.  If this app is going to live on a busy server, that could be relevent.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources