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#">

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 26, 2004 11:47 AM
To: CF-Talk
Subject: custom tags on-the-fly

  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
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to