I've always wondered in what circumstance 'ExecutionMode' would be useful and this is the best example I've seen.
Thanks again,
Brett B)
Aaron DC wrote:
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 <mailto:[EMAIL PROTECTED]>
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
-- Brett Payne-Rhodes Eaglehawk Computing t: +61 (0)8 9371-0471 f: +61 (0)8 9371-0470 m: +61 (0)414 371 047 e: [EMAIL PROTECTED] w: www.ehc.net.au
--- 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
