By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,822 Members | 729 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,822 IT Pros & Developers. It's quick & easy.

Help: Replacing string with template result

P: 1
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.

Expand|Select|Wrap|Line Numbers
  1. <!-- viewcontent.cfm -->
  3. <cfquery name="pagecontent" datasource="myDB">
  4.     Select id, mytext from contenttable
  5.     Where id = 5
  6. </cfquery>
  9. <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:

Expand|Select|Wrap|Line Numbers
  1. <CFOUTPUT>#replace(mytext,"[peopleoutofoffice]", GetOutOfOffice.cfm)#</CFOUTPUT>
  4. <!-- GetOutOfOffice.cfm -->
  6. <cfquery name="OutOfOffice" datasource="myDB">
  7.     Select firstname, surname, status from persontable
  8.     Where status is "out"
  9. </cfquery>
  12. <table>
  13. <tr>
  14.     <td>The following people is out of office</td>
  15. </tr>
  17. <cfoutput query="OutOfOffice">
  18. <tr>
  19.     <td>#firstname# #surname#</td>
  20. </tr>
  21. </cfoutput>
  23. </table>

How do i solve this problem?
Dec 14 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
Welcome to TSDN!

Interesting problem. I don't know if it's even possible, so how about setting a Coldfusion variable to the string within the template, including that template within the page and then using the variable instead of the template name in your replace function?
Dec 14 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.