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 8331457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:25:23+00:00 2026-06-09T02:25:23+00:00

I am trying to use $this->load->add_package_path to add a new sub-application to my CI

  • 0

I am trying to use $this->load->add_package_path to add a new sub-application to my CI app. I can see how to use this for views and such: just put

$this->load->add_package_path("/mypackage");

in the controller ctor. Unfortunately, that doesn’t help, because I want to find controllers from the package path: it seems like a chicken-and-egg problem. Is there somewhere else I can put a add_package_path call (such as index.php)?

  • 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-06-09T02:25:25+00:00Added an answer on June 9, 2026 at 2:25 am

    Figured it out by tracing through CI. Turns out you can’t do this. You can put your own controllers in a subdirectory of /application/controllers, but you cannot put them someplace else: in particular, as http://codeigniter.com/user_guide/libraries/loader.html implies,

    These elements can be libraries (classes) View files, Helpers, Models, or your own files.

    “Your own files” not including controllers. I ended up being able to get it to look to the ENVIRONMENT setting in addition to APPPATH by making changes to CodeIgniter.php and Router.php. I don’t like making this kind of change, however, so I backed out the changes. I’ll put this here in case somebody else can benefit from it.

    Router.php change:

    function _validate_request($segments)
    {
    ...
      // Does the requested controller exist in the root folder?
      if (file_exists(APPPATH.'controllers/'.$segments[0].'.php')
          || file_exists(ENVIRONMENT.'/controllers/'.$segments[0].'.php')) // New bit here
      {
        return $segments;
      }
    ....
    }
    

    CodeIgniter.php change, ’round about line 246:

    if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'))
    {
      // New bit here
      if ( ! file_exists(ENVIRONMENT.'/controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'))
      {
        show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
      }
      include(ENVIRONMENT.'/controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');
    } else {
      include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to use this page slider jquery plugin, you can see the demo
Ok I have this problem I'm trying to use Jquery to load a partial
Trying to use this code to connect the AD PrincipalContext context = new PrincipalContext(ContextType.Domain,
I am trying to use this purr in my app so when this click
I'm trying to use a multiview control. I'm first creating some views and add
I'm trying to use slime from CVS (2009-01-05) but keep getting this error: LOAD:
I am trying to use CodeModuleListener in my application. I am testing this on
Trying to use this method (gist of which is use self.method_name in the FunnyHelper
trying to use this route: from(activemq:profiles).aggregate(header(cheese)).batchSize(30).bean(ProfilesQueueService, saveContacts) Fails with: No signature of method: org.apache.camel.model.RouteType.aggregate()
I'm trying to use this to create a splash screen, but I only get

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.