|
Hi Barry
I programmed in Dataflex for a couple of years,
many moons ago, and love Cold Fusion for exactly the same reason: it is an
interpreted language. Basically, this means you can do anything you damn well
please with it. Anything. I whipped this up after you posed the question, tested
it and it works. You can play with it to your heart's content to make it more
robust - I only put one check in (to make sure it's an assignment
statement).
File: with.cfm
==========
<CFIF thisTag.ExecutionMode EQ
"End">
<CFLOOP Index="Line" List="#thisTag.GeneratedContent#" Delimiters="#Chr(13)#"> <CFSET Line=Trim(Line)> <CFIF Find("=", Line) GT 0> <CFSET junk = Evaluate("Caller.#Attributes.Var##Line#")> </CFIF> </CFLOOP> <CFSET thisTag.GeneratedContent = ""> </CFIF> Example usage:
============
<CFSET test = StructNew()>
<CF_With Var="test"> .ele1 = "hello" .ele2 = "there" .ele3 = "thexthy" </CF_With> Possible enhancement ideas:
1. change delimiters to #Chr(13)# & ";" and
then you could have .ele1 = "hello";.ele2="there"; etc etc
2. make the tag recursive or handle nested calls
and you could nest <CF_with ...> constructs
HTH Aaron ----- Original Message -----
From: Barry
Beattie
does CF (maybe
within CFSCRIPT) have something
like VB�s WITH keyword when working with object
methods and properties? eg: WITH myObject
.val1 = var1
.val2 = var2
.addnew() END
WITH You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia http://www.mxdu.com/ + 24-25 February, 2004 |
- [cfaussie] Re: CF version of VB's "WITH" ? Mark M
- [cfaussie] Re: CF version of VB's "WITH"... Gary Menzel
- [cfaussie] Re: CF version of VB's "WITH"... Barry Beattie
- [cfaussie] Re: CF version of VB's "WITH"... Aaron DC
- [cfaussie] Re: CF version of VB's "WITH"... Brett Payne-Rhodes
- [cfaussie] Re: CF version of VB's "WITH"... Barry Beattie
- [cfaussie] Re: CF version of VB's "WITH"... Elliot Russo
- [cfaussie] Re: CF version of VB's "WITH"... Aaron DC
- [cfaussie] Re: CF version of VB's "WITH"... Sean A Corfield
- [cfaussie] Re: CF version of VB's "WITH"... Mark Woods
