简体   繁体   中英

Codeigniter pagination base_url overrides default base_url()

I'm using codeigniter 2.1 and loaded pagination library in a controller. The pagination is working just fine, the only problem is,

I had to add (for pagination library in the controller that loads it)

$config['base_url'] = site_url('members/sites/'.$current_segment);

Which is fine, but it seems to override the default base_url(); to this URL in all pages under that controller. I don't want that.

I have included a sidebar navigation, and all the links there are getting changed from something like

http://www.mysite.com/about to http://www.mysite.com/members/sites/about

Which is annoying. Is there something I'm doing wrong?

I don't want add nother default URL like

$config['base_url']['one'] = "www.mysite.com"
$config['base_url']['two'] = "www.myothersite.com"

I think there should be a better way to do this. Any help is very much appreciated :) Thanks in advance

Okay I got it :)

I was creating my links like " >All Sites

And now I think, why was it working at all??? Thats why I couldn't figure it out.. It shouldn't have worked :)

I did not echo the base_url(), so it got changed relative to the url as I just mentioned in my question (which is also weird)

However, my problem was solved by typing

" >All Sites

Thanks everyone for seeing this question Hope that helps someone...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM