Reputation: 69
I have a newsletter register FORM, I want include the same FORM for all the views in my CodeIgniter project without repeat code in each controller for each view, must be only one controller for handle the form.
Load the view or include in another views is not the problem, the problem is not repeating the handling (js validation and record data in the database).
Upvotes: 0
Views: 54
Reputation: 2885
You can include more than one View per function, as well as call views within views.
$this->load->view('template');
and within template...
$this->load->view('header');
$this->load->view('form');
$this->load->view('footer');
Upvotes: 3
Reputation: 36937
Have the form be a independent view all by itself.. and on a per view basis where you want to include it in.. you can either include()
it in or load it like a view within the view $this->view->load()
(may be wrong with that syntax off hand but yea) generally thats how you would/could do it.
Upvotes: 0