|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Using a cf variable inside a cf variable
I'm currently developping a website 100% CF dynamic my problem is that I want to do some CF inside a CFoutput variables.
Example: <cfquery datasource="mydatasource" name="content"> <cfoutput query="content">#mytext#</cfoutput> ----- and inside the mytext the data would be: bla bla bla <cfmail ...> lkshalkjfhkj</cfmail> --- I want my CFmail to work not to only write the text "<cfmail>" Is this just impossible with Cold Fusion or is there a trick I don't know |
|
#2
|
||||
|
||||
|
You may have to elaborate because what you wrote is a little hard to follow.
<cfmail> can be nested in a <cfoutput> without issue, however it cannot be nested inside a <cfquery>. You are also not allowed to output a string with #'s and expect CF to process the code. By outputting the string, CF is already processing the code, and once it's done, it's done and it moves on. Try using Eval(mytext) and it may process the code, although there's no guarantee. I would just make this a function and send the stuff that way. |
|
#3
|
|||
|
|||
|
Yes what you're asking for doesn't really make sense. You want to output an entire <cfmail> tag set as text and have the CF engine process it? I don't think it's possible, but the real question is, why would you do this?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#4
|
|||
|
|||
|
I want to do this because all of my website is 100% dynamic, all my website is working from my index.cfm and contenu.cfm page, the reste is all query. All my menu are load via my id , all my different header are loading via that IP.
What I want to do is to have my "Contact us" form in the page contenu.cfm?id=10 and when I submit my form I want it to call "contenu.cfm?id=11" and in that I would have my cfmail tag inside mytext variables -- <cfquery datasource="mydatasource" name="content"> Select mytext from content where id = #url.id# </cfquery> <cfoutput query="content">#mytext#</cfoutput> I know that this is probably impossible, but is I don't ask I will never be sure, there always somebody smarter somewhere, it don't mean that if we don't know that nobody know. I will probably have to hard code some of my page and that piss me off. Quote:
|
|
#5
|
|||
|
|||
|
Yes, first, it's impossible because CF compiles to Java classes prior to runtime.
Second, no offense but that is a very bad idea in and of itself. Not only would such a site be agonizingly slow because all the code would have to be handled at runtime AFTER all the queries had run, but maintaining it would be a nightmare. Let me put it this way: could you imagine doing this with Java or C#? No way. A better approach would be to code yourself well abstracted, encapsulated and reusable code files either as cfm files, custom tags, or CFCs. The n-tier approach has become popular among the CF folks... |
|
#6
|
|||
|
|||
|
Thanks for your comment
I guess i'll move on with reusable cfm files. I know that my idea sound silly, but for us, that have the full picture of our website, it's not that silly. I guess technology is still not strong enough to process this. Maybe one day. Quote:
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Using a cf variable inside a cf variable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|