Re: Won't evaluate?
So why isn't this working then? cfset UserCount = #Users.Recordcount# cfset Question = #Replace(FAQ.Question, '$$UserCount$$', #usercount#, ALL)# cfset Answer = #Replace(FAQ.Answer, '$$UserCount$$', #usercount#, ALL)# a name=#FAQ.FAQID#/a div class=FAQQuestion #Question# /div P div class=FAQAnswer #Answer# /div Azadi Saryev wrote: another alternative may be to get your users.recordcount number in a variable in the page that displays the answer, and in your text in db store a placeholder, like $$usersnumber$$, and then at cfoutput replace the placeholder text with the actual number from the variable in the page. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313737 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
Is it inside a loop over a query? If so then scope your outputed variables in those div elements. Also do not need the pound signs in your two cfsets both on the replace functions and the usercount variables. On Fri, Oct 10, 2008 at 1:40 PM, Phillip M. Vector [EMAIL PROTECTED] wrote: So why isn't this working then? cfset UserCount = #Users.Recordcount# cfset Question = #Replace(FAQ.Question, '$$UserCount$$', #usercount#, ALL)# cfset Answer = #Replace(FAQ.Answer, '$$UserCount$$', #usercount#, ALL)# a name=#FAQ.FAQID#/a div class=FAQQuestion #Question# /div P div class=FAQAnswer #Answer# /div Azadi Saryev wrote: another alternative may be to get your users.recordcount number in a variable in the page that displays the answer, and in your text in db store a placeholder, like $$usersnumber$$, and then at cfoutput replace the placeholder text with the actual number from the variable in the page. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313738 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
So why isn't this working then? [snip] Not sure - make sure the database contains this text: We have currently $$UserCount$$ players signed up with this site ? Also, your code has far too many hashes - here it is cleaned up a little: cfset UserCount = Users.RecordCount cfset Question = Replace( FAQ.Question , '$$UserCount$$' , UserCount , ALL ) cfset Answer = Replace( FAQ.Answer , '$$UserCount$$' , UserCount , ALL ) cfoutput div class=FAQQuestion id=#FAQ.FAQID# #Question# /div div class=FAQAnswer #Answer# /div /cfoutput ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313739 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
So why isn't this working then? cfset UserCount = #Users.Recordcount# cfset Question = #Replace(FAQ.Question, '$$UserCount$$', #usercount#, ALL)# You're not using # signs correctly : cfset UserCount = Users.Recordcount cfset Question = Replace(FAQ.Question, '$$UserCount$$', usercount, ALL) # sign should be used only inside CFOUTPUT tags, rarely inside other CF tags. But this may not be the only reason. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313740 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
I know.. I know.. It isn't pretty code.. But it's how I learned how to do it and old habbits are hard to break. I seriously doubt that the #'s are messing things up. Yup. Cleaned it up and it's still not displaying correctly. Claude Schneegans wrote: So why isn't this working then? cfset UserCount = #Users.Recordcount# cfset Question = #Replace(FAQ.Question, '$$UserCount$$', #usercount#, ALL)# You're not using # signs correctly : cfset UserCount = Users.Recordcount cfset Question = Replace(FAQ.Question, '$$UserCount$$', usercount, ALL) # sign should be used only inside CFOUTPUT tags, rarely inside other CF tags. But this may not be the only reason. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313741 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
Peter Boughton wrote: Not sure - make sure the database contains this text: We have currently $$UserCount$$ players signed up with this site Yup. That's all that is in the field. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313742 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
Here's the full code. cfoutput query=FAQ cfset UserCount = Users.Recordcount cfset Question = Replace(FAQ.Question, '$$UserCount$$', usercount, ALL) cfset Answer = Replace(FAQ.Question, '$$UserCount$$', usercount, ALL) a name=#FAQ.FAQID#/a div class=FAQQuestion #Question# /div P div class=FAQAnswer #Answer# /div HR /cfoutput So yeah. it's looping fine. Just doesn't show any usercount. Aaron Rouse wrote: Is it inside a loop over a query? If so then scope your outputed variables in those div elements. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313743 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
Is it inside a loop over a query? If so then scope your outputed variables in those div elements. That sounds likely to be the problem - CF will give priority to the query vars in resolving unscoped variables. To clarify a little, the possible solutions are: 1) Scope the variable, e.g. using #Variables.Question# instead of just #Question# 2) Overwrite the values in the query, i.e. cfset FAQ.Question[CurrentRow] = replace(...) ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313744 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
old habbits are hard to break. If you have someone kick you every time you do it, you can break most habits much quicker. :) ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313745 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
I'm just using a cfoutput querry loop. But I put in [CurrentRow] just in case. No change. Still not working. Peter Boughton wrote: Is it inside a loop over a query? If so then scope your outputed variables in those div elements. That sounds likely to be the problem - CF will give priority to the query vars in resolving unscoped variables. To clarify a little, the possible solutions are: 1) Scope the variable, e.g. using #Variables.Question# instead of just #Question# 2) Overwrite the values in the query, i.e. cfset FAQ.Question[CurrentRow] = replace(...) ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313746 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
Heh.. True enough. Peter Boughton wrote: If you have someone kick you every time you do it, you can break most habits much quicker. :) ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313747 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
Replace(FAQ.Question, '$$UserCount$$', usercount, ALL) It may also be an question of upper/lower case. Are you sure you always have UserCount ? If not, use replaceNoCase() instead. just doesn't show any usercount. Does it show any '$$UserCount$$' then ? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313748 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Like Aaron and Peter said, SCOPE your variables like so: cfoutput query=FAQ cfset VARIABLES.UserCount = Users.Recordcount cfset VARIABLES.Question = Replace(FAQ.Question, '$$UserCount$$', VARIABLES.usercount, ALL) cfset VARIABLES.Answer = Replace(FAQ.Question, '$$UserCount$$', VARIABLES.usercount, ALL) a name=#FAQ.FAQID#/a div class=FAQQuestion #VARIABLES.Question# /div P div class=FAQAnswer #VARIABLES.Answer# /div HR /cfoutput When you are referencing #Question# you are actually referencing #FAQ.Question# and not #VARIABLES.Question#, so it wont work Phillip M. Vector wrote: Here's the full code. cfoutput query=FAQ cfset UserCount = Users.Recordcount cfset Question = Replace(FAQ.Question, '$$UserCount$$', usercount, ALL) cfset Answer = Replace(FAQ.Question, '$$UserCount$$', usercount, ALL) a name=#FAQ.FAQID#/a div class=FAQQuestion #Question# /div P div class=FAQAnswer #Answer# /div HR /cfoutput So yeah. it's looping fine. Just doesn't show any usercount. Aaron Rouse wrote: Is it inside a loop over a query? If so then scope your outputed variables in those div elements. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313751 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
Claude Schneegans wrote: Replace(FAQ.Question, '$$UserCount$$', usercount, ALL) It may also be an question of upper/lower case. Are you sure you always have UserCount ? If not, use replaceNoCase() instead. It's exactly that. just doesn't show any usercount. Does it show any '$$UserCount$$' then ? Yes. Here is what it shows.. === What is LARP? $$UserCount$$ ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313752 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
I'm just using a cfoutput querry loop. But I put in [CurrentRow] just in case. No change. Still not working. Not sure if you're understanding fully, so I'll simplify completely: (apologies if any of this is patronising) This code here: cfoutput query=FAQ #Question# /cfoutput Will do the same as this: cfoutput query=FAQ #FAQ.Question[FAQ.CurrentRow]# /cfoutput If you did this: cfoutput query=FAQ cfset Variables.Question = X/ #FAQ.Question[FAQ.CurrentRow]# /cfoutput You wouldn't be surprised that the output didn't change (I hope). The following is IDENTICAL to ColdFusion as the above code: cfoutput query=FAQ cfset Variables.Question = X/ #Question# /cfoutput And this code is also IDENTICAL to ColdFusion as both the above: cfoutput query=FAQ cfset Question = X/ #Question# /cfoutput In other words, when you *set* the variable Question, it goes into the global Variables scope. However, when you *read* the variable Question, because you are looping through the query, it looks first in the query's scope. This is one of the reasons you find many people saying you should always scope all variables - it avoids issues like this. To make things work as you want, you need to either read the global Variables scope, or instead to change the value within the query scope. All make sense? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313753 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
Phillip M. Vector wrote: Peter Boughton wrote: 1) Scope the variable, e.g. using #Variables.Question# instead of just #Question# Did you do this one Phillip. I'm late to this discussion so I don't really know what your issue is. But you have some pretty ambiguous code here. div class=FAQQuestion #Question# /div Is ColdFusion seeing that as 'variables.question' or 'variables.FAQ.question' you have both on this block of code. And it may not be picking the one you want to output. If so then be specific in which one you want. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313754 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
Like I said if it is in a loop over a query then you need to scope the variables within the div elements. That is your problem. On Fri, Oct 10, 2008 at 1:57 PM, Phillip M. Vector [EMAIL PROTECTED] wrote: Here's the full code. cfoutput query=FAQ cfset UserCount = Users.Recordcount cfset Question = Replace(FAQ.Question, '$$UserCount$$', usercount, ALL) cfset Answer = Replace(FAQ.Question, '$$UserCount$$', usercount, ALL) a name=#FAQ.FAQID#/a div class=FAQQuestion #Question# /div P div class=FAQAnswer #Answer# /div HR /cfoutput So yeah. it's looping fine. Just doesn't show any usercount. Aaron Rouse wrote: Is it inside a loop over a query? If so then scope your outputed variables in those div elements. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313755 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
Ian Skinner wrote: div class=FAQQuestion #Question# /div Is ColdFusion seeing that as 'variables.question' or 'variables.FAQ.question' you have both on this block of code. And it may not be picking the one you want to output. If so then be specific in which one you want. OOOohhh *slaps forehead* I get the idea now.. Thanks. I can name them Q and A and use that (Yup. Tried it and it works). Yeah... I feel stupid now. :) ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313756 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
Thanks for the explination. I understand the issue now. :) Peter Boughton wrote: I'm just using a cfoutput querry loop. But I put in [CurrentRow] just in case. No change. Still not working. Not sure if you're understanding fully, so I'll simplify completely: (apologies if any of this is patronising) This code here: cfoutput query=FAQ #Question# /cfoutput Will do the same as this: cfoutput query=FAQ #FAQ.Question[FAQ.CurrentRow]# /cfoutput If you did this: cfoutput query=FAQ cfset Variables.Question = X/ #FAQ.Question[FAQ.CurrentRow]# /cfoutput You wouldn't be surprised that the output didn't change (I hope). The following is IDENTICAL to ColdFusion as the above code: cfoutput query=FAQ cfset Variables.Question = X/ #Question# /cfoutput And this code is also IDENTICAL to ColdFusion as both the above: cfoutput query=FAQ cfset Question = X/ #Question# /cfoutput In other words, when you *set* the variable Question, it goes into the global Variables scope. However, when you *read* the variable Question, because you are looping through the query, it looks first in the query's scope. This is one of the reasons you find many people saying you should always scope all variables - it avoids issues like this. To make things work as you want, you need to either read the global Variables scope, or instead to change the value within the query scope. All make sense? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313757 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
While the naming is bad, why not learn from the experience and try to scope things? It could save you a lot of random headaches over the years. On Fri, Oct 10, 2008 at 2:22 PM, Phillip M. Vector [EMAIL PROTECTED] wrote: Ian Skinner wrote: div class=FAQQuestion #Question# /div Is ColdFusion seeing that as 'variables.question' or 'variables.FAQ.question' you have both on this block of code. And it may not be picking the one you want to output. If so then be specific in which one you want. OOOohhh *slaps forehead* I get the idea now.. Thanks. I can name them Q and A and use that (Yup. Tried it and it works). Yeah... I feel stupid now. :) ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313758 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
Phillip M. Vector wrote: Ian Skinner wrote: div class=FAQQuestion #Question# /div Is ColdFusion seeing that as 'variables.question' or 'variables.FAQ.question' you have both on this block of code. And it may not be picking the one you want to output. If so then be specific in which one you want. Thanks. I can name them Q and A and use that (Yup. Tried it and it works). Or just be specific in what you wanted to output. Modifying your original code in the following manner will achieve the exact same result as changing the variable names, and demonstrates a better practice of scoping your variables. I hope you at least wrote that as 'variables.q' and 'variables.a'! :-) div class=FAQQuestion #variables.Question# /div ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313759 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
Ian Skinner wrote: Or just be specific in what you wanted to output. Modifying your original code in the following manner will achieve the exact same result as changing the variable names, and demonstrates a better practice of scoping your variables. I hope you at least wrote that as 'variables.q' and 'variables.a'! :-) Fair enough. No, I didn't actually name them Q and A. :) I named them AdjustedQuestion and AdjustedAnswer. As for putting variable. before every variable will take quite a bit of work for the app I'm working on. Yes, I know scoping my variables is a good thing now and I will from now on when needed. But honestly, it so rarely comes up as an issue (I don't know what I was doing naming the variable the same name as the field) that it seems redundant to do so (well, until something like this happens). :) ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313760 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Won't evaluate?
Just wondering out loud... Is it possibly treating $$ as $, like for quotes and hashes? Also, try it without any variables ie. Replace(ABC $$UserCount XYZ, '$$UserCount$$', 999, ALL), then introduce them 1 at a time until it breaks. -Original Message- From: Phillip M. Vector [mailto:[EMAIL PROTECTED] Sent: Friday, October 10, 2008 3:08 PM To: cf-talk Subject: Re: Won't evaluate? Claude Schneegans wrote: Replace(FAQ.Question, '$$UserCount$$', usercount, ALL) It may also be an question of upper/lower case. Are you sure you always have UserCount ? If not, use replaceNoCase() instead. It's exactly that. just doesn't show any usercount. Does it show any '$$UserCount$$' then ? Yes. Here is what it shows.. === What is LARP? $$UserCount$$ ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313761 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Won't evaluate?
We all have our slow days Philip :-D It's a good thing slapping of the forehead doesn't leave permanent marks...I would be so disfigured if that were the case hehehe. Eric /*-Original Message- /*From: Phillip M. Vector [mailto:[EMAIL PROTECTED] /*Sent: Friday, October 10, 2008 2:23 PM /*To: cf-talk /*Subject: Re: Won't evaluate? /* /*Ian Skinner wrote: /* div class=FAQQuestion /* #Question# /* /div /* /* Is ColdFusion seeing that as 'variables.question' or /*'variables.FAQ.question' you have both on this block of code. And it may /*not be picking the one you want to output. If so then be specific in /*which one you want. /* /*OOOohhh *slaps forehead* I get the idea now.. Thanks. I can name /*them Q and A and use that (Yup. Tried it and it works). Yeah... I feel /*stupid now. :) /* /* ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313762 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Won't evaluate?
I used to not scope and had to teach myself to scope and break that habit...next one I am working on is cfqueryparam... One day at a time... Maybe we need to create a 12 step program for CF developers hehehe *grin* Eric /*-Original Message- /*From: Aaron Rouse [mailto:[EMAIL PROTECTED] /*Sent: Friday, October 10, 2008 2:28 PM /*To: cf-talk /*Subject: Re: Won't evaluate? /* /*While the naming is bad, why not learn from the experience and try to /*scope /*things? It could save you a lot of random headaches over the years. /* /*On Fri, Oct 10, 2008 at 2:22 PM, Phillip M. Vector /[EMAIL PROTECTED] wrote: /* /* Ian Skinner wrote: /* div class=FAQQuestion /* #Question# /* /div /* /* Is ColdFusion seeing that as 'variables.question' or /* 'variables.FAQ.question' you have both on this block of code. And it /*may /* not be picking the one you want to output. If so then be specific in /*which /* one you want. /* /* OOOohhh *slaps forehead* I get the idea now.. Thanks. I can name /* them Q and A and use that (Yup. Tried it and it works). Yeah... I feel /* stupid now. :) /* /* /* /* ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313763 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
I became a scoping nazi back when I had to start working with a home built framework that did not scope a single thing. It made it rather difficult to back track through things and see how it was supposed to be working(since it did not always work right). On Fri, Oct 10, 2008 at 3:13 PM, Eric Roberts [EMAIL PROTECTED] wrote: I used to not scope and had to teach myself to scope and break that habit...next one I am working on is cfqueryparam... One day at a time... Maybe we need to create a 12 step program for CF developers hehehe *grin* Eric /*-Original Message- /*From: Aaron Rouse [mailto:[EMAIL PROTECTED] /*Sent: Friday, October 10, 2008 2:28 PM /*To: cf-talk /*Subject: Re: Won't evaluate? /* /*While the naming is bad, why not learn from the experience and try to /*scope /*things? It could save you a lot of random headaches over the years. /* /*On Fri, Oct 10, 2008 at 2:22 PM, Phillip M. Vector /[EMAIL PROTECTED] wrote: /* /* Ian Skinner wrote: /* div class=FAQQuestion /* #Question# /* /div /* /* Is ColdFusion seeing that as 'variables.question' or /* 'variables.FAQ.question' you have both on this block of code. And it /*may /* not be picking the one you want to output. If so then be specific in /*which /* one you want. /* /* OOOohhh *slaps forehead* I get the idea now.. Thanks. I can name /* them Q and A and use that (Yup. Tried it and it works). Yeah... I feel /* stupid now. :) /* /* /* /* ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313764 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
Yes, I know scoping my variables is a good thing now and I will from now on when needed. But honestly, it so rarely comes up as an issue Right. A good practice to avoid trouble if you don't scope is at least to use different names for variables in different scopes, especially with queries. The problem with queries is that inside a CFOUTPUT on a query, the query scope become implicit and have precedence over the variables scope, but not outside. Using different names will prevent confusions. Like in your case cfset FAQQuestion = Replace(FAQ.Question instead of cfset Question = Replace(FAQ.Question ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313767 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
I have in my DB under the field of answer... We have currently #users.recordcount# players signed up with this site that your event would reach. While it may not be many in the pure view, if 7 come to your convention, that would pay for our services (Figuring the room costs a total of $200 and you charge $30 for admission). Any above that can't hurt your bottom line. exactly. The #users.recordcount# as well. When I run this code.. cfoutput query=FAQ div class=FAQAnswer #Evaluate(FAQ.Answer)# /div /cfoutput It shows #users.recordcount# (with the pound signs) and not 32 like I would think it would.. I tried also just putting #FAQ.Answer#, but that doesn't work either. How do I make CF treat data it pulls from the DB as variables and not a string? Going back to you original question, contrary to Azadi's and Matt's answers, you can do this. I am not sure this is better then the replacement technique that has already been worked out, but in the names of fairness and completeness. You could have done something like this. cfoutput query=FAQ div class=FAQAnswer #Evaluate(DE(FAQ.Answer))# /div /cfoutput It requires a combination of the de() 'delay evaluate' and evaluate() functions to get ColdFusion to render variables contained inside of string variables. No guarantees on how robust this solution is, but it is technically possible. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313769 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
Thanks! :) This makes it allot easier. :) Ian Skinner wrote: Going back to you original question, contrary to Azadi's and Matt's answers, you can do this. I am not sure this is better then the replacement technique that has already been worked out, but in the names of fairness and completeness. You could have done something like this. cfoutput query=FAQ div class=FAQAnswer #Evaluate(DE(FAQ.Answer))# /div /cfoutput It requires a combination of the de() 'delay evaluate' and evaluate() functions to get ColdFusion to render variables contained inside of string variables. No guarantees on how robust this solution is, but it is technically possible. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313770 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
Ian Skinner wrote: cfoutput query=FAQ div class=FAQAnswer #Evaluate(DE(FAQ.Answer))# /div /cfoutput O.K. I have never really done anything with this recursive rendering of ColdFusion variables inside of ColdFusion variables before. But this is kind of cool to my geeky soul!!! In a very much, 'Why the hell would you ever do this!' way cfset aString = Here is some ##change_this## text. cfset change_this = (The quick brown fox jumped ##myOhMy## over the lazy dog.) cfset myOhMy = {{You have got ##no_do_not_do_it## to be kidding!}} cfset no_do_not_do_it = [[[Stop this madness now]]] cfoutput #aString# hr / #evaluate(de(aString))# hr / #evaluate(de(evaluate(de(aString# hr / #evaluate(de(evaluate(de(evaluate(de(aString))# hr / /cfoutput ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313771 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
Yeah but you have to be careful with how much you use those functions in an application. I know at least on our CF6 server here for one project that extensively uses those it does in fact eat up a good bit of resources when a normal user load is on it. On Fri, Oct 10, 2008 at 4:50 PM, Ian Skinner [EMAIL PROTECTED] wrote: I have in my DB under the field of answer... We have currently #users.recordcount# players signed up with this site that your event would reach. While it may not be many in the pure view, if 7 come to your convention, that would pay for our services (Figuring the room costs a total of $200 and you charge $30 for admission). Any above that can't hurt your bottom line. exactly. The #users.recordcount# as well. When I run this code.. cfoutput query=FAQ div class=FAQAnswer #Evaluate(FAQ.Answer)# /div /cfoutput It shows #users.recordcount# (with the pound signs) and not 32 like I would think it would.. I tried also just putting #FAQ.Answer#, but that doesn't work either. How do I make CF treat data it pulls from the DB as variables and not a string? Going back to you original question, contrary to Azadi's and Matt's answers, you can do this. I am not sure this is better then the replacement technique that has already been worked out, but in the names of fairness and completeness. You could have done something like this. cfoutput query=FAQ div class=FAQAnswer #Evaluate(DE(FAQ.Answer))# /div /cfoutput It requires a combination of the de() 'delay evaluate' and evaluate() functions to get ColdFusion to render variables contained inside of string variables. No guarantees on how robust this solution is, but it is technically possible. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313773 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Won't evaluate?
And finally, do you really want a user to be able to add any random CF expression into the DB to be executed? Combine this with something like a URL variable or form post and the results could make SQL injection look like a minor inconvenience. Replacing placeholders is much safer. mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ 2008/10/11 Aaron Rouse [EMAIL PROTECTED] Yeah but you have to be careful with how much you use those functions in an application. I know at least on our CF6 server here for one project that extensively uses those it does in fact eat up a good bit of resources when a normal user load is on it. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313774 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
cf won't evaluate your variable inside a variable (#users.recordcount# inside #FAQ.answer). you best bet will be to either store that text in a cfm file and cfinclude it, or do it on the fly by pulling that text from db, writing it to a temp file and cfinclude that file. another alternative may be to get your users.recordcount number in a variable in the page that displays the answer, and in your text in db store a placeholder, like $$usersnumber$$, and then at cfoutput replace the placeholder text with the actual number from the variable in the page. hth Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Phillip M. Vector wrote: I have in my DB under the field of answer... We have currently #users.recordcount# players signed up with this site that your event would reach. While it may not be many in the pure view, if 7 come to your convention, that would pay for our services (Figuring the room costs a total of $200 and you charge $30 for admission). Any above that can't hurt your bottom line. exactly. The #users.recordcount# as well. When I run this code.. cfoutput query=FAQ div class=FAQAnswer #Evaluate(FAQ.Answer)# /div /cfoutput It shows #users.recordcount# (with the pound signs) and not 32 like I would think it would.. I tried also just putting #FAQ.Answer#, but that doesn't work either. How do I make CF treat data it pulls from the DB as variables and not a string? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313700 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
The short answer is: you don't. The longer version is, you can setup placeholders and do a replace on them to enter the values that you're wanting to use. On Thu, Oct 9, 2008 at 8:38 PM, Phillip M. Vector wrote: How do I make CF treat data it pulls from the DB as variables and not a string? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313702 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Won't evaluate?
Ok.. Thanks. :) Matt Quackenbush wrote: The short answer is: you don't. The longer version is, you can setup placeholders and do a replace on them to enter the values that you're wanting to use. On Thu, Oct 9, 2008 at 8:38 PM, Phillip M. Vector wrote: How do I make CF treat data it pulls from the DB as variables and not a string? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313704 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4