Welcome Guest, Not a member yet? Register   Sign In
get base_url() inside custom config file
#1

[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');

$config['css'] = '' . base_url() . '/static/css';

Output this:
Code:
Fatal error: Call to undefined function base_url() in /var/www/_meuboletim/application/config/meuboletim.php on line 3

#2

[eluser]Otemu[/eluser]
Check out the guide here on loading a custom config file http://ellislab.com/codeigniter/user-gui...onfig.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




Theme © iAndrew 2016 - Forum software by © MyBB