[eluser]Twisted1919[/eluser]
[quote author="WishBear*" date="1297967386"]@Twisted1919: Doesn't my suggestion answer his question? from the categories controller he will pass the result to the blog controller and load that result to the blog container view?[/quote]
You say:
Code:
class Blog extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
$data['categories'] = $this->load->view('category/list', null, TRUE);
$this->load->view('container', $data);
}
}
So you assign a view to a variable, right ? IE:
$data['categories'] = $this->load->view('category/list', null, TRUE);
BUT you don't pass the categories to the view.
Assuming that in the loading view, there is a foreach($categories AS $cat) loop going through categories and echo them one by one, in your method, this will error, because the $categories is undefined.
Do you understand my point here ?
In order to make it function, you would need something like:
Code:
class Blog extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
// get the blog categories and assign them to a variable
$this->load->model('categories_model','cat');
$categories=$this->cat->get_categories();
$data['categories'] = $this->load->view('category/list', array('categories'=>$categories ), TRUE);
// now, the category/list view can use the foreach() as stated above.
$this->load->view('container', $data);
}
}