macromedia.coldfusion.advanced_techniques
[Top] [All Lists]

Re: Variable within a variable?

Subject: Re: Variable within a variable?
From: Adam Cameron
Date: Tue, 31 Mar 2009 21:22:07 +0100
Newsgroups: macromedia.coldfusion.advanced_techniques

>  I changed the #keyword# to {keyword} and then used the following funciton to 
> replace it:
> 
>  #Replace(content,'{keyword}', keyword)#
> 
>  It worked!
> 
>  Now the question is, "What is the most elegant way to handle multiple 
> variables within the content?"

The most elegant way of doing it is to write it to a file and using
<cfinclude>, like Dan said.

Doing that means you don't have to horse around with tokens like {keyowrd},
or running really slow string function on each token you've got.  You're
already got the CF compiler on hand to do all that sort of stuff with you.
The one conceit the compiler has is that you need to give it a *file*.  

Save the file.  Include the file.

-- 
Adam

<Prev in Thread] Current Thread [Next in Thread>