Where should I put menu items in MVC with PHP - Model or Controller? This is my first attempt with MVC and I almost get it, but a small thing bothers me.

I have this controller in CodeIgniter:

&lt;?php
class Page extends CI_Controller {

    public function index($page = "home")
    {
            $data['page'] = $page;
            list($data['title']) = array_keys($this-&gt;_menu(), $page);
            $data['menuItems'] = $this-&gt;_menu();

            $this-&gt;load-&gt;view('templates/header', $data);
            $this-&gt;load-&gt;view('templates/menu', $data);
            $this-&gt;load-&gt;view('pages/'.$page, $data);
            $this-&gt;load-&gt;view('templates/footer', $data);
    }

    private function _menu()
    {
        static $menuItems = array(
                           "Home page" =&gt; "home",
                           "Our history" =&gt; "history",
                           "About us" =&gt; "about",
                           "Contact page" =&gt; "contact"
                       );

        return $menuItems;
    }
}


And here is the menu view:

&lt;?php
$menu = "";
foreach ($menuItems as $menuName =&gt; $view) {
    $menu .= '&lt;li';
    if ( $page == $view ) {
        $menu .= ' class="selected"&gt;';
        $menu .= '&lt;a href="#"&gt;';
    } else {
        $menu .= '&gt;&lt;a href="' . $view . '"&gt;';
    }
    $menu .= $menuName . '&lt;/a&gt;&lt;/li&gt;' .PHP_EOL ;
}

echo $menu;


Where do the menu items belong in MVC logic?  Is it ok to store things like the menu in the Controller or do I have to make a new Model for it like this?

class Menu extends CI_Model {

    public function __construct()
    {
        parent::__construct();
    }

    public function get_menu_items()
    {
        static $menuItems = array(
                           "Home page" =&gt; "home",
                           "Our history" =&gt; "history",
                           "About us" =&gt; "about",
                           "Contact page" =&gt; "contact"
                       );

        return $menuItems;  
    }
}              


Then load it from Controller:

public function index($page = "home")
{
    ...
    $this-&gt;load-&gt;model('Menu');
    $data['menuItems'] = $this-&gt;Menu-&gt;get_menu_items();

    $this-&gt;load-&gt;view(...);
    $this-&gt;load-&gt;view(...);
    $this-&gt;load-&gt;view(...);
}
This a nice example: it shows how the MVC is just a pattern which should be ajusted to your needs.


The menu items you're showing seem very unlikely to change over time. This means you can simply put them in your "templates/menu" view.
If they're shared among multiple views, then the controller is OK.
If the menu items can change dynamically, then your model can provide a meaningful abstraction over your data, and then it would go into a model.