1

I'm trying to get another framework working inside of CodeIgniter and this other framework has it's own config file. One of the values it needs is the site or base url. I thought I'd simply use CI's base url value from the application/config/config.php file. I've tried two methods:

  1. Simply use base_url(). The url helper is being autoloaded. This produces "Fatal error: Call to undefined function base_url()"
  2. Do a require_once APPPATH . 'config/config.php';, then use $config['base_url']. This method works for using application/config/database.php's database values. But for the base url, I get this error: "Message: Undefined variable: config". I don't understand why it works for database.php but not config.php.

What is the correct way to do this?

2
  • Which framework did you try to integrate with CI and how did you do that? Commented Aug 9, 2013 at 13:49
  • It's called PHPDevKit. I basically created a class that interfaces with this framework. Commented Aug 9, 2013 at 18:48

1 Answer 1

1

not sure if this will help but try it - go to your config file and make base url blank

$config['base_url'] = '';

go to the main index.php and look for

  * -------------------------------------------------------------------
  *  CUSTOM CONFIG VALUES

then insert this with your url

    $assign_to_config['base_url'] = 'http://yourdomain.com';

you should then be able to use base_url()

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.