Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cfapplication and this.mapping for component

New Here ,
Sep 24, 2015 Sep 24, 2015

Hi,

Sorry to ask but I am struck and don't know where to go on.  Any suggestions are appreciated. Here is the structure of the site.  All the components are inside the components directory.  With et directory, I'd like to create an Application.cfc for that.  Files in et directory will call up functions in components directory.  I tried to create this.mappings in et Application.cfc but don't seem to recognize or work.  What do I need in sub Application.cfc (et folder) to call components?

Application.cfc (root application.cfc)

-components folder

-ce folder

-et folder

     - Application.cfc

     -index.cfm

     -test.cfm

With the root Application.cfc, it has the following:

<cfcomponent displayname="Application" output="true" hint="Handle the application.">

<!--- set up per application mappings --->

  <cfset this.mappings = {}>

  <cfset this.mappings["/components"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "components">

  <cfset this.mappings["/ce"] = GetDirectoryFromPath( GetCurrentTemplatePath() )>

    <!--- Set up the application. --->

    <cfset THIS.Name = "Test" />

    <cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 1, 0, 0 ) />

    <cfset THIS.SessionManagement = true />

    <cfset THIS.SessionTimeout = CreateTimeSpan( 0, 1, 0, 0 ) />

    <!---<cfset THIS.SetClientCookies = true />--->

    <cfset THIS.SetClientCookies = false />

    <cfset THIS.loginstorage="Session">

   

</cfcomponent>

783
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 25, 2015 Sep 25, 2015

I could be incorrect, but I believe the application.cfc in your "et" directory is stopping CF from using the application.cfc in the root (CF iteratively looks for an application.cfc - once it finds one, it stops looking.)

So, your root app mapping is not being set if running .cfm/.cfc from "et" folder.

You _could_ conceivably set a mapping within your "et" application.cfc to the components folder in the root, but I'm not sure how well that would work.

V/r,

^_^

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 02, 2015 Oct 02, 2015
LATEST

WolfShade wrote:

You _could_ conceivably set a mapping within your "et" application.cfc to the components folder

Bam! That's what I would do, too.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources