Accessing CFCs in parent directories

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Re: Accessing CFCs in parent directories

    Anybody?

    Bueller?
    mate of the state Guest

  2. Similar Questions and Discussions

    1. Accessing a ComboBox from the parent component
      I have a component that contains several other components and a combobox with date values. I want to be able to access the value of the combobox...
    2. CFCs and MX7
      I have a site with a photo album that utilizes CFCs and it worked great until my ISP switched to MX7. When they asked me if I thought I would have...
    3. Child user control accessing parent properties
      We have a user control (Titlebar) that loads other user controls (children) into itself based on a property set in the HTML: <fss:Titlebar...
    4. Using virtual directories for common directories (scripts, images, styles, etc.)
      Hi, (sorry for the crosspost, I wasn't sure which was the best place to put this). I was just thinking about something and wondered if any of...
    5. #24735 [NEW]: call_user_func on parent method does not use parent private property
      From: tater at potatoe dot com Operating system: OS X 10.2 PHP version: 5CVS-2003-07-21 (dev) PHP Bug Type: Zend Engine 2...
  3. #2

    Default Re: Accessing CFCs in parent directories

    What does the directory structure of your site look like? That is, is the
    'public site root' and 'admin' sections under the CF site root? eg:
    /CFRoot/admin/... /CFRoot/public/... Are they running under different
    instances of CF, different machines, etc.... Have you looked at exposing the
    CFC's as a webservice? Could you provide more information about your setup.

    BSterner Guest

  4. #3

    Default Re: Accessing CFCs in parent directories

    Certainly, B. :) I'm very new to CFCs, and it's sometimes hard to know what to
    assume in general. My setup is like so: /root/ /root/admin/ I want to be
    able to put common CFCs in a folder at the root level. It doesn't really matter
    where that folder is, I guess. the main point is how to access a single set of
    common CFCs from anywhere within' a site's directory structure. It's one
    instance of CF, all one machine, etc. Simple setup, and hopefully a simple
    solution. ;)

    mate of the state Guest

  5. #4

    Default Re: Accessing CFCs in parent directories

    In that case, you should be able to reference the component with respect to
    root,rdegardless of the sub-directory you're in. <cfinvoke
    component='/components/GenericDB.cfc' ....> where '/components' resides under
    your site root. Here's an article on site structure (And MVC design) if you're
    interested. I found it useful when I was learning to use CFC's.
    [url]http://www.benorama.com/coldfusion/patterns/part8.htm[/url]

    BSterner Guest

  6. #5

    Default Re: Accessing CFCs in parent directories

    Oh, okay! Thanks, B. :)

    Is there anyway to do the same using the createObject function? That is what I was doing to begin with.
    mate of the state Guest

  7. #6

    Default Re: Accessing CFCs in parent directories

    Sure...

    <cfscript>
    //Using dot notation
    myStr = createObject("component", "components.myCFC");

    //Using slash notation
    myStr = createObject("component", "/components/myCFC");

    //Function name is 'getStr()'
    writeoutput(mystr.getStr());
    </cfscript>

    BSterner Guest

  8. #7

    Default Re: Accessing CFCs in parent directories

    Weird. I thought I tried that, with the dot notation. :\
    mate of the state Guest

  9. #8

    Default Re: Accessing CFCs in parent directories

    Just make sure you directory structure matches the pattern. That is...

    components.level1.level2.myCFC

    Should be in the following location...

    /site_root/components/level1/level2/myCFC.cfc
    BSterner Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139