Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 864141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:25:36+00:00 2026-05-15T09:25:36+00:00

UPDATE: Seems that railo doesn’t have this issue at all. UPDATE: I’m voting to

  • 0

UPDATE: Seems that railo doesn’t have this issue at all.

UPDATE: I’m voting to close this issue as i as feel people are focusing more on the whole “does someone have a better idea splitting up large components” part of this question (which i should never have put in) then the real problem of using cfincludes with cfcomponent.

Note: this is just a simplified example of what i’m trying to do to get the idea across.

The problem I’m having is that I want to use cfinclude inside cfcomponent so that i can group like methods into separate files for more manageability. The problem I’m running into is when i try to extend another component that also uses cfinclude to manage it’s method as demonstrated below. Note that ComponentA extends ComponentB:

ComponentA
==========
<cfcomponent output="false" extends="componentb">
    <cfinclude template="componenta/methods.cfm">
</cfcomponent>

componenta/methods.cfm
======================
<cffunction name="a"><cfreturn "componenta-a"></cffunction>
<cffunction name="b"><cfreturn "componenta-b"></cffunction>
<cffunction name="c"><cfreturn "componenta-c"></cffunction>
<cffunction name="d"><cfreturn super.a()></cffunction>

ComponentB
==========
<cfcomponent output="false">
    <cfinclude template="componentb/methods.cfm">
</cfcomponent>

componentb/methods.cfm
======================
<cffunction name="a"><cfreturn "componentb-a"></cffunction>
<cffunction name="b"><cfreturn "componentb-b"></cffunction>
<cffunction name="c"><cfreturn "componentb-c"></cffunction>

The issue is that when i try to initialize ComponentA I get an the error: “Routines cannot be declared more than once. The routine a has been declared twice in different templates.”

The whole reason for this is because when you use cfinclude it’s evaluated at RUN TIME instead of COMPILE TIME.

Short of moving the methods into the components themselves and eliminating the use of cfinclude, how can i get around this or does someone have a better idea splitting up large components?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:25:37+00:00Added an answer on May 15, 2026 at 9:25 am

    My advice is: reanalyze your objects, try to apply to all the OOP rules and best practices (abstraction, encapsulation, modularity, polymorphism, inheritance, DRY etc.).

    So basically you want component B to have method isCrunchable(), then component A extends B, and isCrunchable() is available from inheritance. Both A and B will return different states so I don’t see any problem with this.
    If you make one class “above” which has all the methods and components A and B extend that one, you’d get your solution for “large components”, but again, I’d try to crunch this a little bit more.

    If this answer doesn’t help, you can post real example, maybe we’ll get better idea why you need this done like that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems that when I use a tool (such as winmerge) to update my
Update: Now that it's 2016 I'd use PowerShell for this unless there's a really
By default the session expiry seems to be 20 minutes. Update: I do not
Update: Check out this follow-up question: Gem Update on Windows - is it broken?
I have a Rails application that has a Company resource with a nested resource
I have trouble getting started with rails 3.0.0, because it just doesn't load the
I find a common issue in my RESTful Rails apps controllers that respond to
Some of the users of our Ruby on Rails app have complained that page
I have a Rails 2.3.5 project that uses the localization features of Rails. I
The Eclipse Visual Editor project seems to be dead, no commits, no updates. Any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.