I wouldn't add the overhead of looping and regex finding where it is totally
not needed. 

Get the selected image record from the database...

If a qry.column is "" replace **image1** with nothing 
Else
Replace it with <img src"/path/to/images/#qry.columnname#"... />

Pretty simple...

You could also just do it based on whether or not the image file exists...

First, Query for the selected image
Then...

If filexists(imagefile)
 Replace **imageN** width img tag using imagefile
Else
 Replace **imageN** with nothing

Again, pretty simple.

Using the "ALL" scope will replace ALL occurrences of each instance you tell
it to... no need for looping and searching and extracting and then relooping
the extracted content and replacing and putting back... etc... etc...

..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com

-----Original Message-----
From: Justin Scott [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 06, 2007 11:22 AM
To: CF-Talk
Subject: RE: Content Placeholders

> Trying to figure out how to use a placeholder in dynamic content to 
> pull in other content at runtime.

I would approach this by using a regular expression with some looping to
pull all of variables out of the content and put them into a list or array.
Then, you can loop through the results, generate the content for each
variable (or discard invalid ones), then replace the variable in the content
with the generated content.  If you made a recursive process to do the
replacements, you could have variables in your generated content as well.


-Justin Scott



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:285569
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to