Steve Brownlee wrote:

> We've all said it a million times - don't use the hashes inside a CF
> tag that
> processes on its own.
>
> <!--- No no no --->
> <cfif #check# eq "1">
>
> But one thing I've always wondered is why.  I know doing this is wrong
> from
> years of seeing people scream at developers who do it, but I never
> heard an
> explanation as to what problems this causes.  Anyone know the guts behind
> this?
>
Originally you had to do your cfifs this way back in version 2 land.

Basically what you are saying here is :

I have a command <CFIF>  inside that command I have a variable called
check that I need to insert the value it contains into the cfif and then
check it against the value on the other side of the operator.

<cfset check = 12>
<cfif #check# eq 1>
becomes
<cfif 12 eq 1>
becomes
false

What you are doing is adding an extra stage of processing to the cfif,
rather than just saying compare the variable "check" against the value
on the other side of the operator.

<cfset check = 12>
<cfif check eq 1>
becomes
false

Plus it looks dreadful and makes your code hard to read.

Stephen
PS. It may not may the slightest difference in CFMX, but it still looks
awful!
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to