Fair 'nuff.  :-)

On Tue, Jun 25, 2013 at 3:11 PM, Rick Faircloth <r...@whitestonemedia.com>wrote:

>
> <sigh> No, Matt... I didn't say your "example is (not) relevant."
>
> I stated, "I don't see how your example is relevant."
>
> See the difference? I put the fault on my part for not understanding your
> example.
>
> Your example may be perfectly relevant, but I couldn't see how.
>
> I think you just misread my statement and assumed I was being offensive
> about your example. If I had said, "your example is not relevant", then
> that
> would be offensive, especially coming from me, someone who is the one
> asking everyone for assistance in understanding what I was trying to do!
>
> So, no offense intended...
>
>
> On Tue, Jun 25, 2013 at 2:35 PM, Matt Quackenbush <quackfu...@gmail.com
> >wrote:
>
> >
> > <sigh> I did. And you flatly stated that my "example is (not) relevant".
> I
> > was merely pointing out - mostly for those who happen upon this thread
> > later, since they'll hopefully read and comprehend - that your assessment
> > is flatly wrong.
> >
> > Good luck.
> >
> >
> > On Tue, Jun 25, 2013 at 2:24 PM, Rick Faircloth <
> r...@whitestonemedia.com
> > >wrote:
> >
> > >
> > > Matt, just participate in the conversation without being asinine about
> > it.
> > >
> > > I haven't asked anyone to "write my code" for me. Just looking
> > > for some guidance as to the correct approach.
> > >
> > > So, offer your advice in a friendly manner, if you're going to offer
> > > it at all.
> > >
> > >
> > >
> > > On Tue, Jun 25, 2013 at 12:56 PM, Matt Quackenbush <
> quackfu...@gmail.com
> > > >wrote:
> > >
> > > >
> > > > You do it exactly like I said you do it: Pass it in as either an
> > argument
> > > > or a property. When you instantiate your contact.cfc, you pass in
> > > > everything it needs from "outside" in order to do its job.
> > > >
> > > > The example I gave is completely relevant, albeit not an example of
> > your
> > > > exact situation. I don't know your exact situation and I'm not going
> to
> > > > write your code for you, but I - along with others here - have
> > definitely
> > > > given you all the information you need to apply the principles to
> your
> > > > exact scenario.
> > > >
> > > >
> > > > On Tue, Jun 25, 2013 at 12:40 PM, Rick Faircloth
> > > > <r...@whitestonemedia.com>wrote:
> > > >
> > > > >
> > > > > Your understanding is correct, Matt, but I don't see how your
> > > > > example is relevant.
> > > > >
> > > > > In my application.cfc, I've got a line that sets an application
> > > variable:
> > > > >
> > > > > <cfset application.siteShortDomain = "myShortDomain.com">
> > > > >
> > > > > I need that application.siteShortdomain variable available when
> > > > contact.cfc
> > > > > runs.
> > > > >
> > > > > So, how would I go about this?
> > > > >
> > > > > (I just noticed what Brian and Russ added to the conversation,
> > > > > and Russ is correct, as you can see from above, that I want to
> extend
> > > > > the global application variables that I've set in application.cfc
> tp
> > > all
> > > > > the other cfc's that are in a common library of cfc's above the
> > website
> > > > > root.
> > > > >
> > > > > ???
> > > > >
> > > > > Thanks!
> > > > >
> > > > > Rick
> > > > >
> > > > >
> > > > > On Tue, Jun 25, 2013 at 11:50 AM, Matt Quackenbush <
> > > quackfu...@gmail.com
> > > > > >wrote:
> > > > >
> > > > > >
> > > > > > Hang on a minute. If I understand this correctly ....
> > > > > >
> > > > > > So, how do I make the variables from application.cfc available to
> > > > > > > contact.cfc under
> > > > > > > such a scenario? Does the "extends" functionality of cfc's
> solve
> > > > this?
> > > > > >
> > > > > >
> > > > > > ... you're thinking about adding `extends="Application"` to your
> > > > > > contact.cfc?  If that's a correct understanding on my part, then
> > the
> > > > > answer
> > > > > > is: "HELL NO! DO NOT USE EXTENDS!"
> > > > > >
> > > > > > Your CFCs should be self-contained and any "outside" variables
> they
> > > > need
> > > > > > should be passed in as either arguments or properties. Here's a
> > > > contrived
> > > > > > example.
> > > > > >
> > > > > > // foo.cfc
> > > > > > component
> > > > > > {
> > > > > >     property name="datasourcename"
> > > > > >
> > > > > >     function init( required string datasourcename )
> > > > > >     {
> > > > > >         variables.datasourcename = arguments.datasourcename
> > > > > >         return this
> > > > > >     }
> > > > > >
> > > > > >     function doQuery()
> > > > > >     {
> > > > > >         // your query goes here
> > > > > >         return mycoolquery
> > > > > >     }
> > > > > > }
> > > > > >
> > > > > > // test.cfm
> > > > > > foo = createObject( 'component', 'foo' ).init(
> > > > > application.datasourcename )
> > > > > > writeDump( foo.doQuery )
> > > > > >
> > > > > >
> > > > > > HTH
> > > > > >
> > > > > > On Tue, Jun 25, 2013 at 11:41 AM, Rick Faircloth
> > > > > > <r...@whitestonemedia.com>wrote:
> > > > > >
> > > > > > >
> > > > > > > Alright, that's the confirmation I needed to proceed. So, "use
> > > > > 'extends"
> > > > > > it
> > > > > > > is!
> > > > > > >
> > > > > > > Thanks,
> > > > > > >
> > > > > > > Rick
> > > > > > >
> > > > > > >
> > > > > > > On Tue, Jun 25, 2013 at 11:21 AM, Russ Michaels <
> > > r...@michaels.me.uk
> > > > >
> > > > > > > wrote:
> > > > > > >
> > > > > > > >
> > > > > > > > if you use EXTENDS, then everything in the parent CFC is
> > > available
> > > > > tot
> > > > > > he
> > > > > > > > child.
> > > > > > > > If you want libraries to use on multiple sites, then you
> would
> > > need
> > > > > to
> > > > > > > put
> > > > > > > > the components in a central location and then adding a
> mapping
> > to
> > > > > them.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On Tue, Jun 25, 2013 at 4:01 PM, Rick Faircloth <
> > > > > > > r...@whitestonemedia.com
> > > > > > > > >wrote:
> > > > > > > >
> > > > > > > > >
> > > > > > > > > Hi, all...
> > > > > > > > >
> > > > > > > > > I've been writing code for every project I've worked on for
> > the
> > > > > last
> > > > > > > 10+
> > > > > > > > > years.
> > > > > > > > > I did that purposefully to make myself work in a manner
> which
> > > > > would,
> > > > > > > > > hopefully,
> > > > > > > > > not cause me to rely on known practices because they were
> > > > familiar
> > > > > > and
> > > > > > > > > understood, but always strive to discover better ways of
> > > coding.
> > > > > > > > >
> > > > > > > > > Now, however, I'm trying to combine reusing code I've
> already
> > > > > written
> > > > > > > > with
> > > > > > > > > enhancing the reused code, instead of writing it from
> scratch
> > > > each
> > > > > > > time.
> > > > > > > > >
> > > > > > > > > On my latest project I decided to take the dive and
> structure
> > > my
> > > > > code
> > > > > > > of
> > > > > > > > > HTML,
> > > > > > > > > CF, jQuery, and CSS in away that allows me to create
> resource
> > > > > > libraries
> > > > > > > > > that I can build upon and reference from within new
> projects.
> > > > > > > > >
> > > > > > > > > I know *not* doing it this way sounds nuts to some of you.
> > But,
> > > > > > again,
> > > > > > > > see
> > > > > > > > > my
> > > > > > > > > first paragraph. There was a method to the madness of this
> > > > > approach.
> > > > > > > > >
> > > > > > > > > But, now I find myself (after days of trying to understand
> > what
> > > > > I've
> > > > > > > > found
> > > > > > > > > on the
> > > > > > > > > Internet and in the CF docs to little avail)  trying to
> get a
> > > > > working
> > > > > > > > > method for this
> > > > > > > > > approach.
> > > > > > > > >
> > > > > > > > > I started first by putting my initial components for the
> > > project
> > > > > > > *above*
> > > > > > > > > the website's
> > > > > > > > > root folder. I knew this was going to be problematic. I, of
> > > > course,
> > > > > > > > > immediately
> > > > > > > > > got the error, "component cannot be found."
> > > > > > > > >
> > > > > > > > > Then, I read about "cfincluding" an application.cfc into an
> > > > > > > > application.cfm
> > > > > > > > > in the
> > > > > > > > > website root folder. For "kicks and giggles", not a real
> > > > solution,
> > > > > > > > because
> > > > > > > > > this approach
> > > > > > > > > is fundamentally flawed, I put an application.cfm in the
> site
> > > > root
> > > > > > > folder
> > > > > > > > > and
> > > > > > > > > used the relative path capability of <cfinclude> to pull in
> > the
> > > > > > > > > application.cfc above
> > > > > > > > > the site web root and it's settings into the site's
> directory
> > > > > > > structure.
> > > > > > > > > Knowing that's
> > > > > > > > > not a solution, I continued to dig on the Internet. Nothing
> > has
> > > > > > > clicked.
> > > > > > > > I
> > > > > > > > > think there
> > > > > > > > > are too many gaps in my understanding to make sense of
> > > everything
> > > > > I'm
> > > > > > > > > reading.
> > > > > > > > >
> > > > > > > > > So, I thought I'd just ask the brains that inhabit the
> world
> > of
> > > > > > CF-Talk
> > > > > > > > and
> > > > > > > > > ask
> > > > > > > > > for a simple explanation of how to go about accessing cfc's
> > > > above a
> > > > > > > > website
> > > > > > > > > root,
> > > > > > > > > that allows those cfc's access to the variables set up in
> > > > > > > application.cfc
> > > > > > > > > when it
> > > > > > > > > resides inside the site root directory structure.
> > > > > > > > >
> > > > > > > > > I'm trying to get this to work in the manner that I access
> > > > > virtually
> > > > > > > > every
> > > > > > > > > cfc currently,
> > > > > > > > > which is through AJAX functionality in jQuery. I can
> access a
> > > > > mapped
> > > > > > > path
> > > > > > > > > created
> > > > > > > > > in application.cfc using AJAX in this manner:
> > > > > > > > >
> > > > > > > > > url: location.protocol + '//' + location.host +
> > > > > > > > >
> '/common/coldfusion/form-processing/contact.cfc?method=json'
> > > > > > > > >
> > > > > > > > > However, the "contact.cfc" has to reference variables setup
> > in
> > > > the
> > > > > > > > > application.cfc,
> > > > > > > > > which exists inside the website root. Unless I place the
> > > > > > > application.cfc
> > > > > > > > in
> > > > > > > > > the same
> > > > > > > > > folder as "contact.cfc", it doesn't work.
> > > > > > > > >
> > > > > > > > > So, how do I make the variables from application.cfc
> > available
> > > to
> > > > > > > > > contact.cfc under
> > > > > > > > > such a scenario? Does the "extends" functionality of cfc's
> > > solve
> > > > > > this?
> > > > > > > Is
> > > > > > > > > that what
> > > > > > > > > I need to understand and implement or do I need to look
> into
> > > > > > something
> > > > > > > > > else?
> > > > > > > > >
> > > > > > > > > Clues? Breadcrumbs?
> > > > > > > > >
> > > > > > > > > Thanks for any feedback!
> > > > > > > > >
> > > > > > > > > Rick
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> --------------------------------------------------------------------------------------------------------------------------------------------------
> > > > > > > > > "Ninety percent of the politicians give the other ten
> > percent a
> > > > bad
> > > > > > > > > reputation."  Henry Kissinger
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356072
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to