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

[eluser]TheFuzzy0ne[/eluser]
Hi. I'm wondering if anyone can offer me a more elegant solution to the one I have.

I have a main template which is loaded, and within that template, I echo the contents, and sidebar. My controller code looks something like this:

Code:
$content_data['title'] = 'Recommended Resources';
$content_data['body_id'] = 'recommendedResources';
$content_data['resources'] = $this->my_model->getResources();
        
$sidebar_data['categories'] = $this->my_model->getCategories();
        
$data['content'] = $this->load->view('recommended_resources/index', $content_data, TRUE);
$data['sidebar'] = $this->load->view('recommended_resources/cats_right_nav', $sidebar_data, TRUE);

$this->load->view('main_template', $data);

That looks quite messy to me, and I will probably need to add more variables at some point also. Does that look right, or is it overkill?

Many thanks in advance.


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