Welcome Guest, Not a member yet? Register   Sign In
Load Views Problem


i am new to CI. I read Tutorials, did the Video Tutorial and read Board Threads but i can't figure out the Following:

I have a main Website Structure like this:

    <title>domain.com - Title ##PageTitle##</title>


    <div id="menu">
      &lt;!-- Menu on each Page --&gt;

    <div id="main">
      &lt;!-- Include the Content from each URL (e.g. /about, /blog, /contact, ...) --&gt;

    <div id="footer">
      &lt;!-- Footer on each Page --&gt;


As you can see, i want to have a Basemenu-File and a Footer-File wich is included in each Page.

Now i want to load the Content of every Page instead of including whole Pages beginning with &lt;html&gt;.
Only Content wich is relevant to the URL.

I know that the views are the files which provides the Content and the Views are fed by the Controllers, but i can figure out how to solve my Problem.

Please help me out :/

In this example Home is the default controller. The web site would have two pages /Home/index and /Home/about. The header view could contain all the html headers then the other views could hold fragments of the html. Im quite new to code ignite so i could have it all wrong, but hopefully this will help you.

class Home extends Controller
function index()
$data['pageTitle'] = "My web site homepage";


function about()
$data['pageTitle'] = "About me";



But is there a main Template wich includes the Content or is it Copy and Paste for all WEbsites?

I'm afraid your question isn't very clear.

Are you using a database, or will your content be static pages?

The above example should help you along [although $this->load->view(‘thaboutpage.php’,$data); should be $this->load->view(‘thaboutpage’,$data);]. Can I suggest you splitting your template into a header.php and footer.php, and writing the content pages as needed. You can then load them as in the example.


Theme © iAndrew 2016 - Forum software by © MyBB