2

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);
wesside
  • 5,622
  • 5
  • 30
  • 35
  • Apparently it was a bug in my version that was fixed in the latest. http://framework.zend.com/issues/browse/ZF-10458 Apply the patch and create your own view helper. and take off the $this->view->escape($label) to just $label. – wesside Aug 30 '12 at 18:17

1 Answers1

1

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; });
} 
b.b3rn4rd
  • 8,494
  • 2
  • 45
  • 57
  • That does work, though, we have a lot of forms and it doesn't escape user input with something like this. Is there a way to specifically target the nav without getting the entire page without overwriting Zend_View_Helper_Navigation_Menu? +1 though, thank you for the response that does accomplish what I need. – wesside Aug 30 '12 at 13:48