![]() |
get base_url() inside custom config file - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: get base_url() inside custom config file (/showthread.php?tid=49767) |
get base_url() inside custom config file - El Forum - 03-02-2012 [eluser]ibnclaudius[/eluser] How can I get base_url() inside custom config file? This: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Output this: Code: Fatal error: Call to undefined function base_url() in /var/www/_meuboletim/application/config/meuboletim.php on line 3 get base_url() inside custom config file - El Forum - 03-12-2012 [eluser]Otemu[/eluser] Check out the guide here on loading a custom config file http://ellislab.com/codeigniter/user-guide/libraries/config.html After you have loaded your config file you should now have access to base_url() if not then check out the helper functions as explained below: Helper Functions The config class has the following helper functions: $this->config->site_url(); This function retrieves the URL to your site, along with the "index" value you've specified in the config file. $this->config->base_url(); This function retrieves the URL to your site, plus an optional path such as to a stylesheet or image. The two functions above are normally accessed via the corresponding functions in the URL Helper. $this->config->system_url(); This function retrieves the URL to your system folder. Hope that helps |