Welcome Guest, Not a member yet? Register   Sign In
about header and footer
#1

[eluser]revanth[/eluser]
Hi all

I am new to codeigniter and i am in learning stage I have some doubt in the controller. I am having header,leftsidelinks and footer in my proj which is in MVC architecture and i placed my header page in the controller constructor and when i am placing my leftsidelinks in controller i am getting error, for this i placed it in another function as leftlinks() in the controller in that i am loading the modal and the data for this one is getting from the modalfunction and for this how can i call the controller function in the indexview page of my proj
#2

[eluser]daparky[/eluser]
What is the exact error message?
#3

[eluser]Michael Wales[/eluser]
Your header, footer, etc. should all be views. HTML goes in views. Your controller will then call all of these views in the correct order or a master layout view that then calls these views (my preferred method - explain in code below).

controllers/posts.php
Code:
function index() {
  // Load a few posts from our blog
  $data['posts'] = $this->post->get_recent(10);

  // Our partial view to load
  $data['partial'] = 'posts/index';

  // Load our master view file
  $this->load->view('layout', $data);
}

views/layout.php
Code:
<?php
  $this->load->view('header');
  $this->load->view($partial);
  $this->load->view('footer');




Theme © iAndrew 2016 - Forum software by © MyBB