473,830 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: Replacing string with template result

1 New Member
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.


[peopleoutofoffi ce]


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; [peopleoutofoffi ce] 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 2337
acoder
16,027 Recognized Expert Moderator MVP
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
1606
by: jamesfin | last post by:
Dear XMLers, Please guide me... I have a simple xml file... <URLTest>
5
2537
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, and then reconstruct another URL based on it. For example, I need to scan a web page looking for something like <a href="some_dir/list_20050815100225.csv">. I don't know in advance what the date/time in the file name will be. I need to take the...
6
11520
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 example string str1; as a class member and then add text to it. or do I have to specify it's length when defining? 2. How to convert from std::string to LPCSTR
3
2434
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
1976
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, either C# or VB.NET, that I can try. Thank You Very Much,
0
5578
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 ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
3
4247
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 little changed since. However, it works only with an obsolete version of Saxon (6.2.2 I think), and it has a number of small bugs; and I've at last got to the point where I need to fix it. And I'm finding it, frankly, absurdly frustrating and...
4
2784
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 (fromStop) and its associated driving directions back to a relational database. I have asked my software vendor for solutions but thus far they have not come up with anything. I am totally unfamiliar with XML so I am struggling with how to do this. I have...
5
1734
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 don't use boost, and this is what I've come up with so far, but it seems fairly ugly. In actual use the final handler that handles the data would know what type the data should be based on other paramaters in the function call, so this is just...
0
9641
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10769
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10479
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10199
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7741
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6948
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5616
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3956
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3073
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.