Professional Web Applications Themes

Is cfinclude'ing from CFCs bad? - Coldfusion - Advanced Techniques

Is it bad to CFINCLUDE a cfm file from a ColdFusion Component? We have run into some strange problems, which we believe are related to a shortage of RAM. But it was also suggested that the problem may be that we are cfinclude'ing files from our CFCs. Does anyone have any knowledge about whether cfnclude's from cfc's are bad? I am not so much asking about best practices but rather whether it will cause unexpected errors. thanks, Steven Rubenstein...

  1. #1

    Default Is cfinclude'ing from CFCs bad?

    Is it bad to CFINCLUDE a cfm file from a ColdFusion Component?

    We have run into some strange problems, which we believe are related to a
    shortage of RAM. But it was also suggested that the problem may be that we are
    cfinclude'ing files from our CFCs.

    Does anyone have any knowledge about whether cfnclude's from cfc's are bad? I
    am not so much asking about best practices but rather whether it will cause
    unexpected errors.

    thanks,
    Steven Rubenstein

    steve@averum.com Guest

  2. #2

    Default Re: Is cfinclude'ing from CFCs bad?

    I never tried that, but tell me ... why do you use CFInclude inside a CFC?
    externalError Guest

  3. #3

    Default Re: Is cfinclude'ing from CFCs bad?

    > Is it bad to CFINCLUDE a cfm file from a ColdFusion Component?

    If you're running CFMX 6.1, it's an idea to tread cautiously here.

    When you have a <cfinclude> within a <cffunction>, it automatically copies
    all your function-local variables to the variables scope. This can create
    "unexpected behaviour", especially if you are "caching" a component
    instance in a shared scope for ease of re-use.

    I believe this has been addressed in CFMX7, but I have not checked yet.

    --

    Adam
    Adam Cameron Guest

  4. #4

    Default Re: Is cfinclude'ing from CFCs bad?

    Ive got a couple of small aps that I use CFINCLUDES inside a CFC. I normally
    use CFINCLUDES to shuffle some of the CFFUNCTION blocks off to separate files.

    I only use it for full CFFUNCTION blocks, never parts of a block, but it seems
    to work just fine for us.

    wubwub Guest

  5. #5

    Default Re: Is cfinclude'ing from CFCs bad?

    Just a follow-up after exchanging emails with Sean Corfield, Director of
    Architecture at Macromedia.

    He said that cfinclude'ing files from CFC functions "is bad practice". I
    personally thought it was good practice to simplify the CFCs, but he said that
    not using cfinclude's encourages people "to refactor their CFCs into smaller,
    more cohesive CFCs."

    As for copying "var" variables into the Variables scope in included files,
    this is a CFMX 6.1 bug that, according to Sean, is fixed in CF7.

    Sean did not specifically say that using cfinclude's will cause errors, but I
    am inclined to believe this practice did contribute to our weird errors. Our
    errors were unrelated to the Variables scope and I am confident they will be
    solved now that we added RAM to our server, but that is not to say the
    cfinclude's did not contribute.

    CF's doentation does say it is ok to use cfinclude's so we are probably
    going to run some tests before moving all of our code into the CFC itself.

    steve@averum.com Guest

  6. #6

    Default Re: Is cfinclude'ing from CFCs bad?

    It would make more logical sense to me if you put the code from the template
    you're calling in the cfinclude statement into a cfc and then use the
    extends="" property of cfcomponent to get it into your component. Just my two
    cents.

    ajpowellatl Guest

Similar Threads

  1. CFCs and RemoteObject
    By spacehog in forum Macromedia Flex General Discussion
    Replies: 4
    Last Post: April 30th, 05:37 PM
  2. cftransaction across cfcs
    By andygeers in forum Coldfusion Database Access
    Replies: 0
    Last Post: April 20th, 10:25 AM
  3. CFCs & Dot Notation
    By jpesolutions in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: July 15th, 01:45 PM
  4. CFCs and MX7
    By ldonner in forum Coldfusion - Getting Started
    Replies: 0
    Last Post: June 22nd, 04:27 PM
  5. Flowchart cfinclude, CFCs, & Custom Tags
    By FinanceCF in forum Macromedia ColdFusion
    Replies: 0
    Last Post: June 20th, 06:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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