Welcome Guest, Not a member yet? Register   Sign In
Best approach/method to pass array in View
#1

[eluser]qpixo[/eluser]
Quick question: When building a website with dynamic contents and menu retrieving from db.

In the controller, I would have two methods to call one Model to get desire queries.
As for display in View, what is the best approach/method to optimize and to call them?

Can I simply call both in same View file?
or better declare 2 public global arrays?

Ex:
Code:
function method1() {
data[$tabMenu] = this->model->getAllMenu(...);
$this->load->view('my_view', $data);
}

function method2() {
data[$tabContents] = this->model->getContentByCategory(...);
$this->load->view('my_view', $data);
}




Theme © iAndrew 2016 - Forum software by © MyBB