Question: Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I'm actually using Kohana).

I'm new to MVC and don't want to get this wrong... so I'm wondering if i have tables:

```
categories, pages, notes

```

I create a separate controller and view for each one...? So people can go to 

```
/category/#
/page/#
/note/#

```

But then lets say I want to also be able to display multiple notes per page, it would be bad to call the note view in a loop from the page view. So should I create some kind of a function that draws the notes and pass variables to that function from the note view and from a loop in the page view? Would this be the best way to go about it, if not how else should I do it...?

Thanks,

Serhiy

Answer: 
I would personally have a "show" method for one item and a "list" method for multiple. In your controller you can say something like `$page_data['note'] = get_note(cat_id,page_id)` for the "show" method and `$page_data['notes'] = get_all_notes(cat_id)` for the "list" method. 

Then in your view, you loop over the `$page_data['notes']` and display HTML for each one. If the list view is using the same "note" HTML as the "show" view, create a template or function to spit out the HTML given a note:

```
// In your "list" view
foreach($n in $page_data['notes']){
    print_note_html($n)
}

//In your "show" view
print_note_html($n)

```

The `print_note_html` function can be a helper method accessible by all views for Notes. Make sense?
1. You can loop in the View. The View is allowed can also access the model in MVC. See: <http://www.phpwact.org/pattern/model_view_controller>
2. You don't need to have a controller (or model) for each table.