Search code examples
phpzend-frameworkzend-navigation

Zend Framework Navigation, escape option to view html within a title?


Alright, I can't find this option anywhere. I'm generating Zend Navigation through the database and into an multi-dimensional array through recursion, cake. So, some of these titles have html in them or html special chars. So, why can't I find the escape option anywhere so I can display these things. Any insight into this maze of framework options would be greatly appreciated.

$this->navigation()
   ->menu()
   ->setUlClass('navbar')
   ->setMinDepth(0)
   ->setMaxDepth(0)
   ->setRenderParents(false) 
   ->setOnlyActiveBranch(false);

Solution

  • You can re-define Zend_View_Abstract escape() behaviour, be default it's using htmlspecialchars.

    Example in bootstrap:

    protected function _initNav()
    {
        $this->bootstrap('view');
        $view = $this->getResource('view');
        $view->setEscape(function($var){ 
            return $var; });
    }