The reason inheritance doesn't work is because CFIMPORT is a
compile-time directive, but each individual CF template is compiled
separately.  So if you compile the parent include, the CFIMPORT is
processed, but when you get to compiling the child include, there
isn't a CFIMPORT tag to deal with.  And you can't just blindly
inherit, because the child include might be included from multiple
different parents.

That's also the reason you have to use a hard path, not a variable. 
Variables don't exist until runtime.

John got it pretty much right on the nose.  You create a mapping
(which you probably already have for your CFCs), and then use that
mapping in your CFIMPORT tags.  I happen to set up a mapping for each
domain like "/com/barneyb", which serves as my CFC root, and then
"/com/barneyb/tags" would be my tag root.  So I might have this:

<cfimport prefix="u" taglib="/com/barneyb/tags/util" />
<cfset myCFC = createObject("component", "com.barneyb.myCFC") />

cheers,
barneyb

On 12/19/05, Geoff Parkhurst <[EMAIL PROTECTED]> wrote:
> > Suggestion... create a standard library of CF files off the
> > site root and call it something like "shared". Then put your
> > custom tags in that directory. If that doesn't fix your issue
> > you could use CFModule... but that should work on any sites.
> > I create a set of tags for my apps in /share/sos and then map
> > them with CFImport from all my apps to "sos" and call the
> > apps like this...
> >
> > <sos:skin ...>
> >
> > </sos:skin>
> >
> > Or public tags in /share/public
> >
> > <public:myTag>
> >
> > And that should solve your issues. It's not exactly "how you
> > want to do it"... but it sure works.
> >
> > John Farrar
>
> I have some files like this:
>
> <cfimport prefix="lh" taglib="../extensions/customtags">
> <lh:nav>
>         <h1>Hello</h1>
>         <cfinclude template="blah.cfm">
> </lh:nav>
>
> In this case, if blah.cfm needs to call a custom tag, it needs its own
> cfimport line...
> So, why can't a cfincluded file inherit a taglib from its 'parent'?
>
> My guess is if blah.cfm was a CFC, having its functionality or resources
> being dependent on a library only made available by the invoking file would
> be bad...
> i.e. blah.cfm wouldn't be a nice self-contained module
>
> Geoff
>

--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 100 invites.


----------------------------------------------------------
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