Welcome Guest, Not a member yet? Register   Sign In
Create a WebSite - Template/Multiple Views
#1

[eluser]fabioneves[/eluser]
Hello there,

I've started using CodeIgniter today and I am having a big trouble create a template for my website.

Let's see, i've read all the user guide and it's fantastic, but it fails to demonstrate how to create a simple template..

I saw in the user guide that we can load multiple views and I successfully loaded them, but there's a problem, how can a view load a dynamic content that is supposed to be loaded from another controller?

Let's see, I have a controller named 'Page', where I load all the views that build up the template, but let's imagine I wanted to load in the sidebar the last 10 comments or something, how would I do that?
Code:
$this->load->view('default/header');
$this->load->view('default/menu');
$this->load->view('default/content', $data);
$this->load->view('default/right');
$this->load->view('default/footer');

$data would be the first content I want to load, it'll be generated in the Page controller, but the others belong to other controllers..

Loading like that, I can build the layout pretty well, my doubt is just how can each view load their respective content?

Dunno if I made me clear, but I'm a little confused right now..

Thanks in advance!


Messages In This Thread
Create a WebSite - Template/Multiple Views - by El Forum - 03-16-2009, 12:38 PM
Create a WebSite - Template/Multiple Views - by El Forum - 03-16-2009, 12:46 PM
Create a WebSite - Template/Multiple Views - by El Forum - 03-16-2009, 01:14 PM
Create a WebSite - Template/Multiple Views - by El Forum - 03-16-2009, 03:50 PM
Create a WebSite - Template/Multiple Views - by El Forum - 03-16-2009, 05:00 PM
Create a WebSite - Template/Multiple Views - by El Forum - 03-16-2009, 05:20 PM
Create a WebSite - Template/Multiple Views - by El Forum - 03-16-2009, 05:25 PM
Create a WebSite - Template/Multiple Views - by El Forum - 03-16-2009, 05:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB