2 Replies Latest reply on Dec 10, 2007 10:54 AM by Newsgroup_User

    Inline CFML?

    Riepster
      Hello,

      We have a component of our site that has content management features. Simply put, we have a bunch of pages in a database, that are managed by a content editor in an admin back end.

      The front end simply pulls the pages from the database as you navigate the site.

      What I am looking to do, is enable us to include pure ColdFusion in the HTML (thru the editor, inside some tags such as <%cf %>), and when the page is called on the front end, that it somehow 'processes' or 'evaluates' this code.

      An example might be as follows:

      HTML In Database:

      <strong>This is my executed code</strong>
      <%cf
      <cfset Stuff=1>
      #Stuff#
      %>

      When this text is pulled from the database, I would like to get all the text inside the <%cf %> tags, store it in a var, and somehow 'process it' and display it.

      Does anyone know if this is possible? Was originally thinking evaluate("CFContent"), but this only processes ## vars, it doesn't not execute script (dies at the first < )

      I've seen this done in Joomla with PHP, and would like to see if I can do it in CF, as it would be very powerful (albeit dangerous too. Serious validation before processing required).

      Don
        • 1. Re: Inline CFML?
          c_wigginton Level 1
          Probably the easiest way would be to create an includes directory and then process the form input and saving it as a cfm file in that directory. Then use a dynamic cfinclude when you retrieve the content.

          <cfinclude template="cmsIncludes\#qry.content_id#.cfm" >
          • 2. Re: Inline CFML?
            Level 7
            Does anyone know if this is possible? Was originally thinking
            evaluate("CFContent"), but this only processes ## vars, it doesn't not
            execute script (dies at the first < )

            I have seen this done, it takes the proper combination of the evaluate()
            and de() [delay evaluate] functions. I believe you want
            #evaluate(de("CFContent"))#, but some experimentation may be required.