»
S
I
D
E
B
A
R
«
MVC for footer-header-sidebar at codeigniter.
November 9th, 2009 by wood

Hi friends,

I use codeigniter. I have footer_view.php, header_view.php and other view php files for pages like aboutus, contactus, etc... for example for about us page, I create model for db actions, than I create a controller to get db variables and send variable to about us view as:

$this->load->view('aboutus/',$data);

everthing is fine until this point. but when I need to get data from db at footer, how will I use mvc way? if I create a footer_model, i cannot make view('footer/') because it is actually a part if page, not a page itself :/

I hope I could explain my issue... I appreciate helps!! Thanks!


One Response  
  • michaeljdennis writes:
    November 9th, 2009 at 1:58 pm

    You can use the load method more than once to load multiple views. Pass your data array into the first view and it will be available in all of the view files. No need to create a footer model.

    $this->load->view(’header’, $data);
    $this->load->view(’view’);
    $this->load->view(’sidebar’);
    $this->load->view(’footer’);


Leave a Reply

»  Substance: PHP Frameworks   »  SiteMap