Welcome Guest, Not a member yet? Register   Sign In
getting rid of my duplicate code! calling the same model functions every view
#6

[eluser]boltsabre[/eluser]
If I follow this correctly, you're just concerned about displaying a few bits of information in your LHS "navigation" column.

For a small internal website/intranet site, I think that hmvc is a bit of an overkill (but it's still a great idea to know about it!), wouldn't simply extending the controller with MY_Controller be a simpler, more time efficient solution?

Simply have a MY_Controller which extends your base CI_Controller, have the MY_Controller do everything you need, then load the results into the global data array.
Code:
$data['estimates_required_counter'] = $this->gd_roofing_model->estimates_required_counter();
$data['estimates_to_dispatch_counter'] = $this->gd_roofing_model->estimates_to_dispatch_counter();
$data['estimates_awaiting_approval_counter'] = $this->gd_roofing_model->estimates_awaiting_approval_counter();
$this->load->vars($data);

Then if you have all your controllers extend MY_Controller, instead of CI_Controller (simple notepad++ search/replace) and presto, you have you data available across the site!


Messages In This Thread
getting rid of my duplicate code! calling the same model functions every view - by El Forum - 02-01-2013, 02:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB