Zend Framework, setting up a dynamic menu using a plugin

I wanted to set up the menu in layout.phtml using a dynamic call to the database.

I created a directory in library called plugins.

I put this in application.ini
autoloaderNamespaces[] = “Plugins”

I created a class in the plugins directory called Plugins_Layout with the file name Layout.php

class Plugins_Layout extends Zend_Controller_Plugin_Abstract
    public function preDispatch(Zend_Controller_Request_Abstract $request)
        $layout = Zend_Layout::getMvcInstance();
        $view = $layout->getView();

        $content_mapper = new Application_Model_ContentMapper();

        $view->menu = $content_mapper->getMenu();

I then added this to Bootstrap.php

protected function _initRoutes() {

       Zend_Controller_Front::getInstance()->registerPlugin(new Plugins_Layout());

I was then able to create the dynamic menu in layout.phtml

 menu as $url => $title) { ?>

All was working as I expected.