I have a problem with the organization of views on CodeIgniter.
Project: Create a simple web application that permits to manage a library(bookcase).
I created 3 models : Member, Categories, Books with their respective controllers.
I implemented the Member model with its controller.
In the member_controller we have:
public function login(){
$this->load->helper('form');
$this->load->helper('email');
$this->load->library('form_validation');
$mail = $this->input->post('mail');
$pass = $this->input->post('pass');
$data['mail'] = $mail;
$data['pass'] = $pass;
$this->form_validation->set_rules('mail', 'mail', 'required');
$this->form_validation->set_rules('pass', 'pass', 'required');
if ($this->form_validation->run() === TRUE)
{
$result=$this->membre_model->login($mail,$pass);
if($result==TRUE){
$this->load->view('templates/header.php');
$this->load->view('membre/logged',$data);
$this->load->view('templates/footer.php');
}
Once user is logged, I want to show all existing categories he previously created(so get them from the database).
- How can I do that?
- Do I have to call a function of the category controller in the login function of the member controller?
- Do I have to load the category view from the Login function?
- Do I have to build the site from just one controller(the member controller)?
- How to build the webapp with differents views of differents controllers?
Finally, the thing I don't get is how the different controller communicate between them.