Its probably not a good idea having CFML code in variables, because in order
to execute it you have to write it to a file (It would be nice if there was
an EvaluateCFML() that would eval tags).

Perhaps if you explained your larger problem the insight of this list may
suggest a better solution.

But for your original question, a good way to do it is to make a start tag
and end tag that will take text and turn it into a variable.

make a file called string2var.cfm
------------------------------------------
<cfif ThisTag.ExecutionMode is "End">
        <cfparam name="attributes.v" default="variable">
        <cfset "Caller.#attributes.v#" = ThisTag.GeneratedContent>
        <cfset ThisTag.GeneratedContent = "">
</cfif>
------------------------------------------

now use it

<cf_string2var v="content">
        <html>
                <head>
                        <title>Hi</title>
                </head>
                <body>
                        yo
                </body>
        </html>
<cf_string2var>

<cfoutput>Content = #content#</cfoutput>


Pete Freitag ([EMAIL PROTECTED])
CFDEV.COM
ColdFusion Developers Resources
http://www.cfdev.com/

-----Original Message-----
From: Gilbert Midonnet [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 31, 2001 3:21 PM
To: CF-Talk
Subject: html and cold fusion in string



As part of trying to solve a larger problem I would like to put a lot (100+
lines) of html and cold fusion code (<CFLOOPS> etc... no SQL) into a string.

Two questions.

1. what's the best way of dealing with this?

<CFSET var1="<html><head>">
...

<CFSET var6="<td class=aaa width=450
align=center>#data.something[aaa].name#</td>">

<CFSET varTotal=var1 & " " & var2 ...>


2. Should I be trying this at all? :>

TIA

-- glm





----------------------------------------------------------------------------
----------------------------------------------------
This message is for the named person's use only. It may contain
confidential, proprietary or legally
privileged information. No confidentiality or privilege is waived or lost by
any mistransmission. If
you receive this message in error, please immediately delete it and all
copies of it from your
system, destroy any hard copies of it and notify the sender. You must not,
directly or indirectly,
use, disclose, distribute, print, or copy any part of this message if you
are not the intended
recipient.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to