But if you do that, then you lose all the meaning of the CFIF tag,
because both the true and false blocks are inside the tag.  If you
look at the JSTL (JSP Standard Template Library), they have an if tag
(with no option for else or else if) and a choose/when/otherwise tag. 
the latter is kind of interesting, it's equivalent to
fi..elseif..else, but it's structured more like switch..case..default:

<c:choose>
  <c:when test="x gt 5">
    x is greater than 5
  </c:when>
  <c:when test="x eq 5">
    x is equal to 5
  </c:when>
  <c:otherwise>
    x is less than 5
  </c:otherwise>
</c:choose>

One alternative (a less desirable one, IMHO) is exemplified in the
Fusebox 4 grammar.  It has three tags, IF, TRUE and FALSE, which are
used like this:

<if condition="x GT 5">
<true>
  It's bigger than 5
</true>
<false>
  It's less than or equal to 5
</false>
</if>

For general-purpose coding, the JSTL's pair of conditional constructs
is definitely superior.  For application structure descriptors (as
FB4's XML files are) the need for conditional logic should be very
little, so it's construct is suitable and simpler (since they're only
one).

cheers,
barneyb

On Fri, 4 Feb 2005 09:45:15 +1000, Taco Fleur <[EMAIL PROTECTED]> wrote:
> I guess its all just one step towards being compliant with xml, all you
> would have to do to make it really compliant is something like the following
> to get around the issue with cfelse.
> 
> <cfif 1 EQ 1 >
> test
> 
> <![CDATA[
> <cfelse>
> ]]>
> 
> </cfif>
> 
> --
> Taco Fleur
> Senior Web Systems Engineer
> http://www.webassociates.com
> 
> -----Original Message-----
> From: Barney Boisvert [mailto:[EMAIL PROTECTED]
> Sent: Friday, 4 February 2005 9:25 AM
> To: CF-Talk
> Subject: Re: cfset ?
> 
> Except that CFML isn't XML compliant.  CFELSEIF and CFELSE, in particular,
> are an issue.  If you use CFSWITCH for all conditionals with more than one
> block, then it'd work (you can still use CFIF without a CFELSE).
> 
> cheers,
> barneyb
> 
> On Fri, 4 Feb 2005 09:20:43 +1000, Taco Fleur <[EMAIL PROTECTED]>
> wrote:
> > Its just to make the code xml compliant, basically you could
> > eventually parse a cfm page and work with it as XML..
> >
> > --
> > Taco Fleur
> > Senior Web Systems Engineer
> > http://www.webassociates.com
> >
> >
> 
> --
> Barney Boisvert
> [EMAIL PROTECTED]
> 360.319.6145
> http://www.barneyb.com/
> 
> Got Gmail? I have 50 invites.
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193019
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to