Im new to Coldfusion, and here is what i would like to do:

I'm using a html-editor on one cfm-page, and saving the text in a database:

--mytext written i the html-editor ----------------------

Nunc libero ligula volutpat ac aliquet id laoreet ac lacus.


In dictum tincidunt turpis. Morbi sodales, justo ut posuere viverra
, mi turpis egestas nunc, ac consequat leo elit vitae pede.


And showing the text entered in the editor on an other page.

<!-- viewcontent.cfm -->

<cfquery name="pagecontent" datasource="myDB">
Select id, mytext from contenttable
Where id = 5

<cfoutput query="pagecontent">#mytext#</cfoutput>

... that's very simple!

But, that i want to do is replacing the string; [peopleoutofoffice] in #mytest# with the result of an other cfm template, like this:

<CFOUTPUT>#replace(mytext,"[peopleoutofoffice]", GetOutOfOffice.cfm)#</CFOUTPUT>

<!-- GetOutOfOffice.cfm -->

<cfquery name="OutOfOffice" datasource="myDB">
Select firstname, surname, status from persontable
Where status is "out"

<td>The following people is out of office</td>

<cfoutput query="OutOfOffice">
<td>#firstname# #surname#</td>



How do i solve this problem?

9 Years
Discussion Span
Last Post by Nige Ridd

My Coldfusion isn't the best - but it would probably be better to convert the GetOutOfOffice.cfm to a cfc which just has a function to return the display content as a string instead.
Alternatively you could test for having [peopleoutofoffice] in your text, then output everything up to that point from the string, then cfinclude the GetOutOfOffice.cfm and then output the rest of the original string. This would mean less changes to your code, but isn't a particularly neat solution.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.