i want to put login form in navigation(template) so that it will be shown in all the pages.
and will check username and password in database without going to other pages. if failed, an error will be shown in the nav and if success, the page will be reloaded again with specific costomizations. please tell me how with code and details.
i have these parts in my template:
- header
- nav
- footer
- and content that will be added in current controller
i wanna do this in each controller:
$this->load->view('templates/header');
$this->load->view('templates/nav');
$this->load->view('related_view');
$this->load->view('templates/footer');
but my navigation should contain a login form which will not go to another page by submitting.
The solution I found is to extend the Controller class. So In this case we should make an extended controller (for example MY_Controller) and put the dynamic action (here authentication) in it as a method.
Then we should extend this self-made controller in each of our controllers , so authentication in the template would be simply handled.