>- see footer for list info -< Stephens idea is certainly the most flexible, and what I would have suggested too, use a MACRO. While you can evaluate till the cows come home, the whole reason why you are doing what you are doing is because you have unknown values and as you also stated, channging or unknown variables too, so request.root may not produce the correct value at any one time. Thus storing it and evaluating it may not be the best solution if there is a possibility that it may evaluate to the wrong value.
By using a [macro] to represent the data, you have no hard-coded values or variables, and you can replace [macro] with whatever you like at any time. Most of the people who say you should not use one tag/function over another are usually obsessive about saving every possible millisecond of processing time, but in reality is having you code run 10ms faster really going to make much difference to you? If not, then use whatever method works best for you. Russ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Adam Cameron Sent: 25 May 2006 14:32 To: Coldfusion Development Subject: RE: [CF-Dev] Dynamic variable evaluation >- see footer for list info -< >When you output the file path you would just replace the place holder with the appropriate variable. eg. >replace(path,"[root]",request.root,"all") >You can probably do some clever bit of regex Why would you do all that instead of just using evaluate()? It seems you're making a rod for your own back there. The usual argument against using evaluate() is that it's dead slow - it is - but that just means don't use it in situations where it's not the best tool for the job: <cfset "dynamicVar#i#" = "foo"> <cfoutput>#evaluate("dynamicVar#i#")#</cfoutput> MOST of the time I see evaluate() in use, it's the above sort of example, which is... NOT the right time to be using it (instead do this): <cfoutput>#variables["dynamicVar#i#"]#</cfoutput> Given the above, people often get it into their heads that "evaluate() is bad in that situation" to "evaluate() is bad in ALL situations". Not so. There are a (/very) few situations in which evaluate() is the tool for the job. And runtime substitution of dynamic values is exactly the right time. As slow as it is, evaluate(de()) is going to be FASTER - not to mention CLEARER - than doing a series of replace() statements to replace a bunch of dynamic values in a string. -- Adam _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- Hosting provided by www.cfmxhosting.co.uk -< >- Forum provided by www.fusetalk.com -< >- DHTML Menus provided by www.APYCOM.com -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help >-< _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- Hosting provided by www.cfmxhosting.co.uk -< >- Forum provided by www.fusetalk.com -< >- DHTML Menus provided by www.APYCOM.com -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
