Hey actually I am new to codeigniter so,I make a controller Admins in thats controller has severals methods http://192.168.0.103:8080/Concept/admins/order problem is when I request this page its load home() method instead of order method here’s some picture of my page where you can see in url I change method but thats still call home()
public function __construct()
{
parent::__construct();
if (!$this->session->userdata('id')) {
redirect('logins/index');
}
$this->home();
}
So whenever you invoke this class, it calls its parent constructor, then it checks if the user is logged in and forces a redirect, otherwise it calls $this->home() with no parameter.
public function home($page='main')
The home function has an optional parameter, which if undefined is set to ‘main’.
Your constructor calls home with no parameter, so $page will always be ‘main’.
oohh thanks but one more thing I need to ask you as you saw the way of my work can you tell how should I redirect this home() method only first time when user log in ?