VARIABLES is the reserved scope for local variables. That is, variables
that are set and available only on the currently processed template. Most
developers choose not to scope local variables, but either code works.
Whenever I inherit code, I have to pick my battles at to what code I "make
my own" and what code I let sit in peace. However, were I to give into the
urge, I'd re-write the code to be:
<CFDIRECTORY
ACTION="List"
DIRECTORY="mypath"
NAME="CurrentDir"
>
<cfoutput>
<CFIF Len(CurrentDir.Name)>
<CFSET production = 1>
<CFELSE>
<CFSET production = 0>
</CFIF>
</cfoutput>
<CFIF production>...
Sharon
-----Original Message-----
From: Terri Stocke <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Friday, August 25, 2000 9:28 AM
Subject: Referring to variables
>Okay, another "best practice" question, I guess...
>
>I have inherited an application from someone. In going through the code, I
>notice that this person refers to several variables by using
>"Variables.(whatever)". I'm assuming "Variables" is a reserverd term? I
>can't find any documentation on this in my reference books.
>
>Why would one choose to reference variables by preceding it this way?
>For example:
>
><CFDIRECTORY ACTION="List" DIRECTORY="mypath" NAME="CurrentDir">
><cfoutput>
> <CFIF #CurrentDir.Name# IS ""> <CFSET PRODUCTION="TRUE">
> <CFELSE> <CFSET PRODUCTION="FALSE">
> </CFIF>
></cfoutput>
>
><CFIF #Variables.PRODUCTION# IS "TRUE"> ... etc.
>
>I would write the IF statement as:
>
><CFIF PRODUCTION IS "TRUE">... etc.
>
>Why did this other person refer to "Variables.PRODUCTION"? They've done
>this throughout the code...
>
>Thanks!
>Terri
>________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>---------------------------------------------------------------------------
---
>Archives: http://www.mail-archive.com/[email protected]/
>To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.