There is nothing wrong with outputting HTML from a CFC. Mixing your presentation business logic is a bad idea, but just because a CFC is an object doesn't mean it can't be for presentation.

-Matt


On Jan 9, 2004, at 1:27 AM, Andrew Scott wrote:


Sean,

I really wasn't looking for a how too, more of a guide if it was ok or not.
I wrote the CFC's, but was looking at expaniding certain logic. In this
case, I wasn't sure if it was frowned upon and was looking if others had
considered putting HTML outputting like this into CFC's. In this case the
code to generate this displays to the browser as well as being able to
email, and I thought if I wrote this in a CFC instead of a custom tag I
could give the application maybe a bit more of an upgrade path in the future
rather than using custom tags.




Regards
Andrew Scott
Technical Consultant

NuSphere Pty Ltd
Level 2/33 Bank Street
South Melbourne, Victoria, 3205

Phone: 03 9686 0485 - Fax: 03 9699 7976


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Sean A Corfield
Sent: Friday, 9 January 2004 4:46 PM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] CFC question and HTML in cfc


On Jan 7, 2004, at 7:57 PM, Andrew Scott wrote:
In regards to components and functions etc., I am looking at creating
a function to be generic to emails. Now should I create code in the
cfc to format the email or do an include for this.

Consider something like this (untested idea):


        <cffunction name="sendEmail" ..>
                <cfargument name="template" type="string" ..>
                ...
                <!--- put data in request.someStruct --->
                <cfsavecontent variable="body">
                <cfinclude template="/emails/#arguments.template#.cfm">
                </cfsavecontent>
                <!--- send email with #body# --->
        </cffunction>

Now the email formatting is all in a separate set of files and the CFC is
"clean". You'd need something more complex for both HTML and plain text
email, but the same principle applies.


Hope that helps?

Sean A Corfield -- http://www.corfield.org/blog/

"SOAP is not so much a means of transmitting data but a mechanism for
calling COM objects over the Web."
-- not Microsoft (surprisingly!)

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool,
Corporation (www.mindtool.com).

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



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

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


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email.


CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

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

Reply via email to