Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Storing cf tags in database

New Here ,
Sep 03, 2008 Sep 03, 2008
Hi,
I am storing in database some text that has coldfusion tags in it. For example:

quote:

This is page #url.pageNum#


When I retrieve this text from the db and display it using cfoutput, the #url.pageNum# does not get processed. Instead, it is shown as a text. What do I do in order to get the coldfusion variable be evaluated?

Thanks,
Min
610
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 03, 2008 Sep 03, 2008
Write it to a file and cfinclude the file.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 03, 2008 Sep 03, 2008
or use the Evaluate function

#Evaluate(url.pagenum)#

be careful of using this function... it is CPU/process intensive. So proceed with caution.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 03, 2008 Sep 03, 2008
Dan, this is for our FAQ list and we are currently storing it in text files. I am attempting to move them to the database so that we can manage them a little easier.

speedpedal, I tried substituting #url.pageNum# with #evaluate(url.pageNum)# but it doesn't work. The problem is that when the string gets retrieved from the db and displayed using <cfoutput>, coldfusion variables in the form of #varName# are not being evaluated and are instead being treated as string. I suppose I could pull out all the #varName# from the text, have them evaluated, and then insert the values back into the text.

Thanks,
Min
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 03, 2008 Sep 03, 2008
can you post some code samples?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 03, 2008 Sep 03, 2008
<!--- Storing the text --->
<cfquery>
insert into faq(questionNum,question,answer)
values(1,'How much is shipping?','Shipping is #dollarFormat(request.shippingCost)#')
</cfquery>

<!--- Retrieving and displaying it --->
<cfquery name="getFAQ">
select question, answer
from faq
where questionNum=1
</cfquery>

<cfoutput query="getFAQ">
Question: #question# <br>
Answer: #answer#
</cfoutput>

<!---The displayed output --->
Question: How much is shipping?
Answer: Shipping is #dollarFormat(request.shippingCost)#

<!--- What I want --->
Question: How much is shipping?
Answer: Shipping is $5.00
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 03, 2008 Sep 03, 2008
Try doing a search of these forums.

This question comes up about once a month, so you should be able to dig up
one of the threads that answered this the last time it was asked.

It's generally better to use Google to do the search than use the "native"
search.

--
Adam
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 03, 2008 Sep 03, 2008
Do you have any suggestion for search keywords to use? I tried some variations of 'storing coldfusion variables in database table' but did not find what I am looking for. Thanks.

Min

quote:

Originally posted by: Newsgroup User
Try doing a search of these forums.

This question comes up about once a month, so you should be able to dig up
one of the threads that answered this the last time it was asked.

It's generally better to use Google to do the search than use the "native"
search.

--
Adam



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 03, 2008 Sep 03, 2008
quote:

Originally posted by: MCL97
Do you have any suggestion for search keywords to use? I tried some variations of 'storing coldfusion variables in database table' but did not find what I am looking for. Thanks.


So did I with an equal lack of success. But you've already been given the two most common answers, write a file or use evaluate().

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 04, 2008 Sep 04, 2008
> Do you have any suggestion for search keywords to use? I tried some variations
> of 'storing coldfusion variables in database table' but did not find what I am
> looking for. Thanks.

"coldfusion code from database" worked on Google. First match.

I concede I could not contrive a query that would pull any results back
from these forums. Given the number of times this has been asked, this is
a sorry indictment of the forums' search engine (and no indictment on you
at all!)

However approaching things from the opposite direction (knowing that the
answer is and searching on that), I found these:
http://tinyurl.com/57zws4
http://tinyurl.com/6gzvl2
http://tinyurl.com/6llo6g
http://tinyurl.com/5g6fum

They might be of some use; they cover the same ground as Dan's answer.

--
Adam
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 04, 2008 Sep 04, 2008
LATEST
Adam,

Thanks for all the links. They are very helpful. I did try using google to search this forum, but I just didn't use the right keywords.

Regards,
Min
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources