I think I'll become a bald because of pulling my hairs...
According to CodeIgniter tutorial and also my previous experience, I can easily determine if 2nd, 3rd or 4th segments exist or what are their values.
if($this->uri->segment(3)) {
//do something
}
or
if($this->uri->segment(3)=="foo") {
//do something
}
Everything is okay for ALL other segments except the FIRST SEGMENT!
I can not use any conditional statements for FIRST SEGMENT!
if($this->uri->segment(1)) does not work. Because it always returns true. But I want to check if first segment exists or NOT. When I browse to my site, because of removing index.php, it looks like www.domain.com . All other controllers goes like domain.com/firstcontroller, domain.com/secondcontroller
BUT I need to create a condition for the WEB ROOT.
I tried __construct() function but it didn't work neither.
The thing I want to do is: I will show some HTML if current page is NOT webroot (even without 1st segment) or it's not my main controller.
Can you help please?
EDIT: Errr... I'm sorry. I've figured out the problem. It was about using correct operator. I was supposed to use XOR instead of OR. So there is no problem with determining $this->uri->segment(1) ... It's just same as other segments...