hrm. to be honest I'm not sure what your asking :O)  are you asking
about the savecontent wrapping only happening once?

If so then maybe this would work (if not , well sorry i missed it).

<cfcomponent ... >
<cffunction name="getContent" returntype="string" output="false"
hint="captures and returns file content">
  <cfargument name="file" type="string" required="true" />
  <cfset var fileContent = "" />
  <cfsavecontent variable="fileContent">
      <cfinclude template="#arguments.file#" />
  </cfsavecontent>

  <cfreturn fileContent />
</cffunction>


<cffunction name="someView" hint="gets the view info for event X">
  <cfreturn getContent("someFileToIncude.cfm") />
</cffunction>
</cfcomponent>


obviously you would have to add some error handling to the getContent
method incase the passed template didn't exist or the path was invalid
(or whatever else might arise).





On Thu, 17 Mar 2005 10:18:16 -0500, Dave Merrill <[EMAIL PROTECTED]> wrote:
> I'm exploring a view cfc (as in semi-ignorant mvc), where every function
> call should return its html as the function result, rather than display it
> directly. Typically, these functions just cfinclude some cfm files, wrapping
> them in cfsavecontent to capture the resulting output.
> 
> Is there any reasonable way to do this wrapping once, and have it effect all
> the functions in all view cfcs? Some less than ideal ideas:
> 
> - Have the "official" view cfcs that everyone talks to contain only the
> cfsavecontent wrapper, and have it call out to a "shadow" view cfc that's
> got the actual code in it. Slightly bent facade, maybe?
>   What I don't like about that is that you have to write your actual view
> code in a different object than the one you talk to.
> 
> - Use a custom tag to access all the view cfcs. It would take an object
> reference and a method, and do the requested call inside cfsavecontent.
>   This isn't a very OO solution.
> 
> - Have a method with similar functionality in the base class for all view
> cfcs. Instead of directly calling whatever view method you want, you call
> this intermediary method, passing it the name of the method you really want
> and all passed arguments. It doesn't need a reference to a view object,
> because it's 'this'.
>   I think I like this one best, but it is a little odd to always call this
> one method, rather than the ones you actually want.
>   This method could also be in the base class for all controller cfcs. It
> would have to be passed a reference to the appropriate view controller, but
> that's doable. Still like the other version better by gut, not sure which is
> more "correct".
> 
> Any other ideas or comments? How can all methods in a class of cfcs inherit
> a "behavior" like this?
> 
> Dave Merrill
> 
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to 
> [email protected] with the words 'unsubscribe cfcdev' as the subject of the 
> email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
> (www.cfxhosting.com).
> 
> An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
> 
> 


-- 
[EMAIL PROTECTED]
http://blog.rawlinson.us

I have 47! gmail invites,want one?

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]

Reply via email to