Welcome Guest, Not a member yet? Register   Sign In
best practice of exposing data to a view
#1

[eluser]Bacteria Man[/eluser]
I'm using a controller->library->model structure. The controller is extremely thin and is responsible for only displaying the view. The library contains all the business logic and the model interacts with the database.

With the above in mind, I'm trying to determine the best practice of exposing data to a view.

The most obvious way is to pass the data in the second parameter. For example:

Code:
$data['title'] = 'My Blog';
$this->load->view('blogview', $data);

What about data produced by the library? I like to return true/false from my functions. If false, the function failed for whatever reason. If true, the data is defined as an object and available to the view.

I suspect that a combination of both techniques is acceptable.

I'd appreciate any comments and/or a confirmation.

Thanks!


Messages In This Thread
best practice of exposing data to a view - by El Forum - 08-09-2007, 02:18 PM
best practice of exposing data to a view - by El Forum - 08-09-2007, 05:00 PM
best practice of exposing data to a view - by El Forum - 08-09-2007, 05:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB