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

  • Home
  • SEARCH
  • 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 7026085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:04:13+00:00 2026-05-28T00:04:13+00:00

Codeigniter has its ‘ENVIRONMENT’ setting such that when in a production environment, by changing

  • 0

Codeigniter has its ‘ENVIRONMENT’ setting such that when in a production environment, by changing the setting to ‘production’, all of the production configuration files are included.

A large amount of my website utilizes javascript. As such I want to have some config such as the below which changes dependent on whether i’m in a local or production environment.

<base href="http://localhost/site/" />
<script type="text/javascript">  
var base_url = 'http://localhost/site/';
</script>

Does anyone know how i can make codeigniter include config/production/custom-config.php
And if I could, surely that wouldn’t be a suitable place for such configuration?

Many Thanks

  • 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-28T00:04:14+00:00Added an answer on May 28, 2026 at 12:04 am

    CodeIgniter includes as base_urlconfiguration variable located in application/config/config.php. You could do something like this:

    <base href="<?php echo base_url(); ?>" />
    <script type="text/javascript">  
        var base_url = '<?php echo base_url(); ?>';
    </script>
    

    Does anyone know how i can make codeigniter include config/production/custom-config.php And if I could, surely that wouldn’t be a suitable place for such configuration?

    You can easily create custom config files. Create a file in the application/config/ folder (or the appropriate environment folder). For example:

    *application/config/production/custom_config.php:*

    <?php
    
    $config['custom_var'] = 'custom value';
    $config['another_var'] = 'another value';
    // ...
    

    Then you can load your new configuration file using:

    $this->load->config('custom_config');
    

    And access your configuration variables using:

    $this->config->item('custom_var');
    

    Finally, take a look at the documentation on the Config Class.

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

Sidebar

Related Questions

I've got a CodeIgniter project that until now has been only run remotely (it
CodeIgniter has a method $this->load->vars($array) that is ideally used in the parent Controller to
Reading all about PHP frameworks, CodeIgniter seems really nice in that I like it's
I know that Codeigniter has a very useful security class which can prevent CSRF/XSRF
I noticed that CodeIgniter has implemented the valid_email() function, in which they are using
Codeigniter has its own Models path, where models extend from CI_Model. I'm using RedBean
I know that codeIgniter turns off GET parameters by default. But by having everything
I'm using CodeIgniter next to a Wordpress install. So, I've got this site that
I'm little confused about controller and model in MVC framework (codeIgniter). Its clear to
I am trying to build a multi-app CodeIgniter site, where the assets for all

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.