Welcome Guest, Not a member yet? Register   Sign In
Loading views within views
#2

[eluser]xwero[/eluser]
I'm a big fan of the vars method but then you have to be careful later variables don't overwrite the older. Your code can look like this
Code:
$this->load->vars(array(
                    // content
                    'title'=>'Recommended Resources',
                    'body_id'=>'recommendedResources',
                    'resources'=>$this->my_model->getResources(),
                    // sidebar
                    'categories'=>$this->my_model->getCategories(),
                    // main_template
                    'content'=>$this->load->view('recommended_resources/index', '', TRUE),
                    'sidebar'=>$this->load->view('recommended_resources/cats_right_nav', '', TRUE),
                  ));

$this->load->view('main_template');
And all your variables will be automagically added to the correct views.


Messages In This Thread
Loading views within views - by El Forum - 02-23-2009, 08:53 AM
Loading views within views - by El Forum - 02-23-2009, 09:04 AM
Loading views within views - by El Forum - 02-23-2009, 09:05 AM
Loading views within views - by El Forum - 02-23-2009, 09:15 AM
Loading views within views - by El Forum - 02-23-2009, 09:24 AM
Loading views within views - by El Forum - 02-23-2009, 09:26 AM
Loading views within views - by El Forum - 02-23-2009, 09:28 AM
Loading views within views - by El Forum - 02-23-2009, 09:28 AM
Loading views within views - by El Forum - 02-23-2009, 09:30 AM
Loading views within views - by El Forum - 02-23-2009, 10:05 AM
Loading views within views - by El Forum - 02-23-2009, 11:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB