2 Replies Latest reply on Apr 19, 2012 3:18 AM by wes_614

    include return output as string


      Hey Everyone,


      I'm new to the land of coldfsuion having come from a php background of several years. In PHP i've always had affiliations with the smarty templating engine which has a somewhat similiar style in coldfusion to cfm's if you were to call them templates.


      I generally code in cfscript objects and in both cfscript and normal cfml can't find any way to return the result of an include (either with include in cfscript or cfinclude in a cfm) as a string.


      We use this very often in smarty so you effectivly compile the given template and return the result as a string to display as a variable in anthher template somewhere else. I cn see that include doesn't have a return type so it's obviously in itself not the answer but if anyone knows a way of doing what i'm asking or can shed some light that would be great.


      An example would be an email i want to send... something like...




      var mail = new Mail();

      mail.setTo("blah blah");

      mail.setSubject("the subject");



      function String getContents()



           return the result of the include here from a given cfm (e.g. include "template.cfm")






      All help appreciated!!