Since you are on CF8, you might get an advantage from dynamically
setting the mappings.  I usually drop common components into a
location below the wwwroot and refer to them using a CF mapping.  The
technique below also allows you to move code server to server without
managing any mappings in the CF Admin or worrying that the directory
structures are the same.

One potential directory structure might look like this:

mytestappl/site1/Application.cfc
mytestappl/site1/UseComponentToShowSiteNameOnSite1.cfm
mytestappl/site2/Application.cfc
mytestappl/site2/UseComponentToShowSiteNameOnSite2.cfm
mytestappl/components/mycomponent.cfc

Ultimately, you can call your component using a CF mapping to
mytestappl.components.mycomponent.

You can then dynamically create a mapping in the Applicaiton.cfc like
below...  Note that getRootDirectory() will find the main application
root dir.

<cfcomponent output="false">

        <cfscript>
        // variables
        this.dsn                                                        = 
'mytesterappl';

        // application settings
        this.name                                                       = 
'mytesterappl';
        this.applicationtimeout                         = 
createTimeSpan(0,0,0,1);
        this.sessionManagement                          = true;
        this.sessionTimeout                                     = 
createTimeSpan(0,0,1,0);

        // mappings
        this.mappings["/mytesterappl"]          = getRootDirectory() & '\';
        </cfscript>

        <!--- finds the root mytesterappl application directory --->
        <cffunction name="getRootDirectory" returnType="string" output="false">
                <cfscript>
                var dir         = getDirectoryFromPath(expandPath('.'));
                var pos         = findNoCase('mytesterappl',dir);
                dir                     = mid(dir,1,pos+11);
                return dir;
                </cfscript>
        </cffunction>

</cfcomponent>

-Cameron

On Tue, Mar 18, 2008 at 12:04 PM, Mischa Uppelschoten ext 10
<[EMAIL PROTECTED]> wrote:
> All,
>  I'm running into an issue with CF8 and how components are bound to form 
> controls. Proper execution of one of my components depends on a value in the 
> session scope.
>
>  Site1\application.cfm  (-> this.name = "site1";)
>  Site1\Components\MyComponent.cfm
>  Site1\UseComponentToShowSiteNameOnSite1.cfm
>
>  Site2\application.cfm   (-> this.name = "site2";)
>  Site2\Components   ... this is an IIS virtual directory that points to  
> Site1\Components
>  Site2\UseComponentToShowSiteNameOnSite2.cfm
>
>  The purpose of the above setup is to share a set of common cfc's between the 
> two sites. If an object is instantiated through CreateObject via the 
> UseComponentToShowSiteNameOnSite2.cfm template, the virtual directory is 
> honored and the application.cfm from site2 is used.
>
>  However, if I use CFGRID with a 
> bind="cfc:Site2.Components.MyComponent.TestFunction...   I can see that the 
> application.cfm from Site1 is used.
>
>  This breaks my application because the required session variables are not 
> available for the user in Site1.
>
>  Is there a better way to share common cfc's and have different 
> application.cfc's apply depending on how they are called?
>
>  (The above is a simplification, let me know if you need code).
>  Thanks!
>  Mischa.
>
>
>
>  -------------------------------------------------------------
>  Annual Sponsor FigLeaf Software - http://www.figleaf.com
>
>  To unsubscribe from this list, manage your profile @
>  http://www.acfug.org?falogin.edituserform
>
>  For more info, see http://www.acfug.org/mailinglists
>  Archive @ http://www.mail-archive.com/discussion%40acfug.org/
>  List hosted by http://www.fusionlink.com
>  -------------------------------------------------------------
>
>
>
>



-- 
Cameron Childress
Sumo Consulting Inc
http://www.sumoc.com
---
cell: 678.637.5072
aim: cameroncf
email: [EMAIL PROTECTED]


-------------------------------------------------------------
Annual Sponsor FigLeaf Software - http://www.figleaf.com

To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------



Reply via email to