>What is it exactly you are trying to do?
>Brendan
It's a CMS system where the user is able to determine the contentType for a particular
contentItem
A Text or an Image is-a ContentItem - that makes sense - so i started out assuming
that the content subtypes would inherit from ContentItem. From the user interface, the
calls to getContentItem had to go through one manager that would be able to decide
which subtype to call. They couldn't go direct to the subtype. I put that in
ContentItem, thinking where else? that's the parent, right? The parent has to
determine the child ... today it looks like this:
<cffunction name="getContentItem" access="public" returntype="any" output="no">
<cfargument name="pos" type="numeric" required="yes" />
<cfset var cachedContentProperties =
thisPage.getContentProperties(pos)>
<cfset var pageState = thisPage.getPageState()>
<cfset var buttonType = "" />
<cfset var newButton = "" />
<cfset var thisContent = "" />
<cfif Len(cachedContentProperties.strContentType)>
<cfset thisContent =
CreateObject('component',#cachedContentProperties.strContentType#).getContent(cachedCo
ntentProperties, pageState, thisDisplay) />
<cfreturn thisContent />
<cfelse>
<cfif pageState.showButtons>
<cfsavecontent
variable="newButton"><cfinclude
template="../buttons/newContent.cfm" /></cfsavecontent>
</cfif>
<cfreturn newButton />
</cfif>
</cffunction>
So it's composition, and along the way i found that "inheritance was useless" in this
case - it didn't work ... today i've been toying with the idea of a ContentManager to
handle the cachedContentProperties and call the appropriate subtype. Then maybe the
subtype would be free to inherit from ContentItem (which would also be instantiated
within ContentManager). But it's working fine as it, giving the responsibility to Page
to function as the ContentManager. I just had to go through a few twists and turns to
get here. But it's been good, i've been learning things every day by jumping into
this, and today is no exception!
----------------------------------------------------------
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]