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

[eluser]Colin Williams[/eluser]
From what I understand, you will have one View that displays all boxes. Then, you'll have one View for each kind of box (assuming there are different kinds of boxes). Information about these boxes would be stored in a database, so you would have a Model to interact with this data. Finally, the Controller would be responsible for fetching the needed boxes and passing them onto the appropriate Views, finally displaying the main View that lists all the boxes.

Code:
class Boxes extends Controller {

function list_boxes()
{
   $this->load->model('boxes_model');
   $boxes = $this->boxes_model->get_user_boxes();
   $data['boxes'] = array();
   foreach ($boxes as $box)
   {
      $data['boxes'][] = $this->load->view('boxes/'. $box->type, array('box' => $box), TRUE);
   }
   $this->load->view('list_boxes', $data);
}

}

That's a pretty basic mock-up. I'm sure you'll find added complexity (especially in the Model) as you continue.


Messages In This Thread
Loading boxes - by El Forum - 08-06-2008, 03:10 PM
Loading boxes - by El Forum - 08-06-2008, 04:29 PM
Loading boxes - by El Forum - 08-09-2008, 08:37 AM
Loading boxes - by El Forum - 08-09-2008, 11:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB