|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
custom tags on-the-fly
Author: mavinson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32808#164559
...but the browser is ignoring it as unknown tag
-- exactly. (view source confirmed your suspicion as well as mine)
...You want the CFML parser to see that tag and it is not.
-- right again.
... I don't know if there is a way to do what you want,
-- ah, cfmodule will allow me to effectively (and efficiently enough)
allow me to gather up the state of my app and fire off the next template.
...sound a bit off kilter to me.
-- Hey, I resemble that statement ;)
Take care, Mike
Author: Ian Skinner
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32808#164535
You might be running into an HTML parsing issue. I bet if you look at your
source code you will see the output you are expecting, but the browser is
ignoring it as unknown tag. I suspect this is not the desired result. You want
the CFML parser to see that tag and it is not. It is just sending the string
down the line to the HTML output. I don't know if there is a way to do what you
want, sound a bit off kilter to me.
--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
"C code. C code run. Run code run. Please!"
- Cynthia Dunning
Confidentiality Notice: This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.
Author: mavinson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32808#164527
Thanks Philip, JE & Barney: I love a one-word answer ..... cfmodule.
Author: J E VanOver
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32808#164523
Nope, EVAL evaluates a string. It doesn't execute tags.
Try calling your tags with <CFMODULE instead of using the <cf_ syntax
<cfset templateString="assign">
<cfset templateAttribs = structNew()>
<cfset templateAttribs.param1 = "foo1">
<cfset templateAttribs.param2 = "foo2">
<cfmodule template="#templateString#.cfm"
attributeCollection="#templateAttribs#">
Hi,
I'm trying to build, evaluate & execute custom tags on the fly by creating
a string ( e.g. "<cf_myTag param1='foo1' param2='foo2'>" ). After toying
with the concept, I'm wondering if a) There's something I simply do not
grasp and/or b) This is generally a silly idea and I need to get on with
the business of writing some case statements.
Here's a few tests & results (using CF 5.0):
<!--- assign.cfm is a working template --->
<cfset templateString = "<cf_assign>">
<cfoutput>
templateString = #templateString#<br>
#templateString#
</cfoutput>
This returns an empty string and doesn't run assign.cfm. As CF doesn't
have escape characters, my guess is that CF is "blowing off" a tag that
doesn't exist (failsafe thingy?).
So then I break out evaluate() whose inner workings I best comprehend
through monkey motion (trial and error):
<cfset templateString = "<cf_assign>">
<cfoutput>evaluate(#templateString#)</cfoutput>
This evaluates to nothing, null, nada... So I change the hash-marks:
<cfset templateString = "<cf_assign>">
<cfoutput>#evaluate(templateString)#</cfoutput>
And CF returns an error (evaluating the expression: <cf_assign>) ... at
least this is the string that I intended - but not the
result.
Any input appreciated,
Thanks, Mike
Author: Barney Boisvert
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32808#164522
You can't do that. If you really need to, you could write your dynamic
string to a file, and then include that file, but that'll be slow, becaue CF
will have to compile the file on every request.
Cheers,
barneyb
----- Excess quoted text cut - see Original Post for more -----
Author: Philip Arnold
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32808#164520
> I'm trying to build, evaluate & execute custom tags on the
> fly by creating a string
No - it won't do it
CFML is compiled into P-Code (for upto CF5) and Java (for CFMX), so it
can't "compile and run a template" on the fly
If you want to run a template like that, then use CFMODULE, you can
specify the template name via a variable
Author: mavinson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32808#164518
Hi,
I'm trying to build, evaluate & execute custom tags on the fly by creating
a string ( e.g. "<cf_myTag param1='foo1' param2='foo2'>" ). After toying
with the concept, I'm wondering if a) There's something I simply do not
grasp and/or b) This is generally a silly idea and I need to get on with
the business of writing some case statements.
Here's a few tests & results (using CF 5.0):
<!--- assign.cfm is a working template --->
<cfset templateString = "<cf_assign>">
<cfoutput>
templateString = #templateString#<br>
#templateString#
</cfoutput>
This returns an empty string and doesn't run assign.cfm. As CF doesn't
have escape characters, my guess is that CF is "blowing off" a tag that
doesn't exist (failsafe thingy?).
So then I break out evaluate() whose inner workings I best comprehend
through monkey motion (trial and error):
<cfset templateString = "<cf_assign>">
<cfoutput>evaluate(#templateString#)</cfoutput>
This evaluates to nothing, null, nada... So I change the hash-marks:
<cfset templateString = "<cf_assign>">
<cfoutput>#evaluate(templateString)#</cfoutput>
And CF returns an error (evaluating the expression: <cf_assign>) ... at
least this is the string that I intended - but not the
result.
Any input appreciated,
Thanks,
Mike
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||