Thanks all. I have decided to go with the following syntax for my fieldnames
<fieldname1, <fieldname2>, etc just to avoid any problems with the hashes.
As there will be limited few fields to deal with I think the less elegant
but simpler 'replace' function should do the job, unless you know of any
example code for doing it better?

-----Original Message-----
From: Barney Boisvert [mailto:[EMAIL PROTECTED] 
Sent: 25 August 2005 18:15
To: CF-Talk
Subject: Re: Replace or REReplace function question.

First, I'd recommend not using CF markup for the fields.  Or at least
don't require the CFOUTPUT tags, just the hashes.  If you have a small
number of fields, loop over them and just do a replace(string,
"##detail.firstname##", detail.firstname, "all") for each one.  Not
real elegant, but it is simple.

A more robust solution would be to parse the text for hashes, and then
check the contents of each pair (making sure to gracefully deal with
floating hashes that aren't delimiters) and substituting the right
content in it's place.  This is a lot more complex, because you'll be
doing a seek/cut/insert loop, rather than just replacing content, but
it allows for a lot more flexibility.

cheers,
barneyb

On 8/25/05, Andy Mcshane <[EMAIL PROTECTED]> wrote:
> Hi all, I am trying to come up with a way to do the following;
> 
> User creates/edits a basic letter/mailshot document on line using
FCKeditor.
> 
> Within this document the user can add some pre-defined CF output fields
i.e. <cfoutput>#details.firstname#</cfoutput>.
> 
> This is with the idea of trying to do a simple mailshot by extracting the
names and addresses required from the database, selecting the
letter/mailshot text from the database, looping thorugh the recordset inside
of a cfdocument tag and producing a PDF of all the letters.
> 
> The point at which I am stuck is actually replacing the output tags
inserted into the original text with the required data from the database
before allowing cfdocument to process it. Does anyone have any
suggestions/ideas on the best way to replace my tags with the required text?
> 

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216459
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to