473,320 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Help: Replacing string with template result

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.


[peopleoutofoffice]


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 -->
  2.  
  3. <cfquery name="pagecontent" datasource="myDB">
  4.     Select id, mytext from contenttable
  5.     Where id = 5
  6. </cfquery>
  7.  
  8.  
  9. <cfoutput query="pagecontent">#mytext#</cfoutput>
  10.  
... 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>
  2.  
  3.  
  4. <!-- GetOutOfOffice.cfm -->
  5.  
  6. <cfquery name="OutOfOffice" datasource="myDB">
  7.     Select firstname, surname, status from persontable
  8.     Where status is "out"
  9. </cfquery>
  10.  
  11.  
  12. <table>
  13. <tr>
  14.     <td>The following people is out of office</td>
  15. </tr>
  16.  
  17. <cfoutput query="OutOfOffice">
  18. <tr>
  19.     <td>#firstname# #surname#</td>
  20. </tr>
  21. </cfoutput>
  22.  
  23. </table>
  24.  
----------------------------------------------------------

How do i solve this problem?
Dec 14 '07 #1
1 2310
acoder
16,027 Expert Mod 8TB
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

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

Similar topics

8
by: jamesfin | last post by:
Dear XMLers, Please guide me... I have a simple xml file... <URLTest>
5
by: Bradley Plett | last post by:
I'm hopeless at regular expressions (I just don't use them often enough to gain/maintain knowledge), but I need one now and am looking for help. I need to parse through a document to find a URL,...
6
by: Nemok | last post by:
Hi, I am new to STD so I have some questions about std::string because I want use it in one of my projects instead of CString. 1. Is memory set dinamicaly (like CString), can I define for...
3
by: Locia | last post by:
I have a Template base class and another subclasses of Template. I have a tree structure of template object. class Template { ArrayList child; public virtual String Eval(Environment env) {
2
by: shapper | last post by:
Hello, I am for days trying to apply a XSL transformation to a XML file and display the result in a the browser. I am using Asp.Net 2.0. Please, could someone post just a simple code example,...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
3
by: Simon Brooke | last post by:
As various people will have noticed, I've been having a lot of trouble with XSL lately. Brief history: I wrote myself an XML toolkit back in 2000, and it worked well enough for me, so it's been...
4
by: Debbiedo | last post by:
My software program outputs an XML Driving Directions file that I need to input into an Access table (although if need be I can import a dbf or xls) so that I can relate one of the fields...
5
by: Jim Langston | last post by:
I am using some code that I got that uses a form a message dispatching where the data is passed via a void*. I don't like void*'s so am experimenting with a different way to do them in C++. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.