Reverse the evaluation order.

Since CGI.ScriptName DOES contain default.cfm it evaluates as TRUE and
never looks at the other conditions.

-----Original Message-----
From: Pete Ruckelshaus [mailto:cflist@;ruckelshaus.com] 
Sent: Wednesday, October 30, 2002 10:22 AM
To: CF-Talk
Subject: CFIF and CFSWITCH brain freeze


I'm having a brain freeze on the differences between how CFIF and
CFSWITCH statements are handled.

How I understand it: CFSWITCH evaluates all expressions "independently"
(i.e. with no regard to other CFCASE values) while CFIF evaluates
expressions serially (i.e. from first to last).  Is this statement true?
Here's the reason I'm asking.

First off, I'm doing this logic inside of a CFSCRIPT block, not that it
should make any difference.

I have this script:

<cfscript>
 IF (CGI.script_name CONTAINS "/default.cfm") {
  ad.category = "1";}
 ELSE IF (CGI.script_name CONTAINS "/directory/default.cfm") {
  ad.category = "2";}
 ELSE IF (CGI.script_name CONTAINS
"/directory/subdirectory/default.cfm") {
  ad.category = "3";}
 ELSE 
  ad.category = "0";
</cfscript>

In this example, If I am on /directory/default.cfm, "2" should be set as
the ad.category value and not "1", correct?  I just want to make sure
that my assumptions are safe before I go too much further on this.

Thanks,

Pete


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to