andacata / HybridIgniter

HybridAuth - CodeIgniter integration
139 stars 84 forks source link

base_url issue? #17

Closed scottybe closed 11 years ago

scottybe commented 11 years ago

My hybridauthlib.php file sets config['base_url'] to '/hauth/endpoint'. What I don't understand is that according to http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html, config['base_url'] should be set to my site's base URL, and I use it to include files like the following:

<script type="text/javascript" src="<?php echo base_url();?>..........

Of course, this doesn't work if I change it's value to '/hauth/endpoint'. What am I missing or doing wrong?

Thanks.

andacata commented 11 years ago

The config['base_url'] in the CodeIgniter documentation refers to the config option inside the file application/config/config.php (CodeIgniter configuration).

The definition inside application/config/hybridauthlib.php is only for the HybridIgniter library.

It's a coincidence that the two options have the same name.

scottybe commented 11 years ago

Ah. My mistake was thinking that I needed to load the hybridauthlib.php config file in MY_Controller with $this->config->load('hybridauthlib'); which overwrote the 'base_url' element of the config array.

Still not sure where it gets loaded, but I took it out and it works. Thanks!

andacata commented 11 years ago

The configuration file is loaded automatically by CodeIgniter when you load the library.

andacata commented 11 years ago

To learn how, you can read the "Passing Parameters When Initializing Your Class" part on http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html (important to read the red paragraph).