beginner question sorry: I have template(just build it from scratch so it's a simple template by html css) that have header, navbar, content, sidebar, footer. but my loginbox is on the sidebar and my view files 'footer.php' consist of sidebar and footer. (so my loginbox is on footer.php) My controller, each method will import the header.php view, somemodule.php(content) view and footer.php view.
the problem is when I write the login method, it does not have content view because loginbox is in footer already. no nescessary for somemodule.php(content)view. (my login form post data to controller login method)
this is my controller
public function login()
{
$this->load->view('header');
/// login and validation algorithm here////
/// not have $this->load->view('some content') ///
$this->load->view('footer'); ////my loginform is in footer
}
public function register()
{
$this->load->view('header');
$this->load->view('register_content'); // See? the other methods have a content view
//// algorithm and validation here /////
$this->load->view('footer');
}
this is my form in the footer view
<?php echo form_open('member/login');?> //post data to method login controller
<h2> Login </h2>
<ul id='login'>
<li>
Username:<br>
<input type='text' name='username'>
</li>
<li>
Password:<br>
<input type='password' name='password'>
</li>
<br>
<li>
<input type='submit' name='btn' value='Log in'>
</li>
</ul>
</form>
When the user input wrong password, I want the website to be on same page with error message and the "content view" still be the same.
or should I write algorithm in Model folder and import it to controller? but it must import that login model to all method of controller because all page have footer(loginbox).