• <i id='7HjaN'><tr id='7HjaN'><dt id='7HjaN'><q id='7HjaN'><span id='7HjaN'><b id='7HjaN'><form id='7HjaN'><ins id='7HjaN'></ins><ul id='7HjaN'></ul><sub id='7HjaN'></sub></form><legend id='7HjaN'></legend><bdo id='7HjaN'><pre id='7HjaN'><center id='7HjaN'></center></pre></bdo></b><th id='7HjaN'></th></span></q></dt></tr></i><div id='7HjaN'><tfoot id='7HjaN'></tfoot><dl id='7HjaN'><fieldset id='7HjaN'></fieldset></dl></div>

      <bdo id='7HjaN'></bdo><ul id='7HjaN'></ul>
      <legend id='7HjaN'><style id='7HjaN'><dir id='7HjaN'><q id='7HjaN'></q></dir></style></legend>

      <small id='7HjaN'></small><noframes id='7HjaN'>

      <tfoot id='7HjaN'></tfoot>

        如何扩展 Zend Navigation Menu View Helper?

        How do I extend the Zend Navigation Menu View Helper?(如何扩展 Zend Navigation Menu View Helper?)

          • <bdo id='3hJXZ'></bdo><ul id='3hJXZ'></ul>

            <legend id='3hJXZ'><style id='3hJXZ'><dir id='3hJXZ'><q id='3hJXZ'></q></dir></style></legend>
          • <tfoot id='3hJXZ'></tfoot>

            <i id='3hJXZ'><tr id='3hJXZ'><dt id='3hJXZ'><q id='3hJXZ'><span id='3hJXZ'><b id='3hJXZ'><form id='3hJXZ'><ins id='3hJXZ'></ins><ul id='3hJXZ'></ul><sub id='3hJXZ'></sub></form><legend id='3hJXZ'></legend><bdo id='3hJXZ'><pre id='3hJXZ'><center id='3hJXZ'></center></pre></bdo></b><th id='3hJXZ'></th></span></q></dt></tr></i><div id='3hJXZ'><tfoot id='3hJXZ'></tfoot><dl id='3hJXZ'><fieldset id='3hJXZ'></fieldset></dl></div>

              <small id='3hJXZ'></small><noframes id='3hJXZ'>

                  <tbody id='3hJXZ'></tbody>

                  本文介绍了如何扩展 Zend Navigation Menu View Helper?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要更改Zend_View_Helper_Navigation_Menu 的输出.我找到了需要修改的两个函数,并且知道如何进行所需的更改.我不知道如何让 Navigation 对象使用我的视图助手而不是 Zend .

                  I need to change the output of Zend_View_Helper_Navigation_Menu. I've found the two functions that I'll need to modify, and I know how to make the changes I need. What I don't know is how to make the Navigation object use my view helper instead of the Zend one.

                  代表我的类扩展的代码片段:

                  Code snippet representing my class extension:

                  // file /library/My/View/Helper/Navigation/Menu.php
                  class My_View_Helper_Navigation_Menu extends Zend_View_Helper_Navigation_Menu
                  {
                      protected function _renderDeepestMenu(Zend_Navigation_Container $container,
                                                            $ulClass,
                                                            $indent,
                                                            $minDepth,
                                                            $maxDepth)
                      {
                          // modified code here
                      }
                  
                      protected function _renderMenu(Zend_Navigation_Container $container,
                                                     $ulClass,
                                                     $indent,
                                                     $minDepth,
                                                     $maxDepth,
                                                     $onlyActive)
                      {
                          // modified code here
                      }
                  }
                  

                  <小时>

                  编辑以澄清

                  我想更改

                • 元素的类并删除 EOL 和缩进.菜单视图脚本没有选项可以做到这一点,这就是我必须扩展它的原因.

                  I want to change the class of the <li> elements and remove the EOL and indentation. There are no options to do that with the menu view script, which is why I'll have to extend it.

                  在我的 Bootstrap 中初始化导航对象:

                  Initializing the navigation object in my Bootstrap:

                  $navTable = new Default_Model_Site_DbTable_Navigation();
                  $view = $this->getResource('view');
                  $view->navigation(new Zend_Navigation($navTable->getNavigation()));
                  

                  在我的布局中渲染菜单:

                  Rendering the menu in my layout:

                  echo $this->navigation()->menu();
                  

                  <小时>

                  解决方案

                  我通过如下重命名使其工作,但我不清楚为什么我不能重载/覆盖 _Menu 类和 menu() 函数.

                  I got it working by renaming things as follows, but I am not clear on why I can't overload/overwrite the _Menu class and menu() function.

                  1. 将类名更改为My_View_Helper_Navigation_MyMenu
                  2. 在类中添加myMenu函数(return parent::menu($container);)
                  3. 在布局中调用echo $this->navigation()->myMenu();

                  类线框:

                  // file /library/My/View/Helper/Navigation/MyMenu.php
                  class My_View_Helper_Navigation_MyMenu extends Zend_View_Helper_Navigation_Menu
                  {
                      public function myMenu(Zend_Navigation_Container $container = null)
                      {
                          return parent::menu($container);
                      }
                  
                      protected function _renderDeepestMenu(Zend_Navigation_Container $container,
                                                            $ulClass,
                                                            $indent,
                                                            $minDepth,
                                                            $maxDepth)
                      {
                          // modified code here
                      }
                  
                      protected function _renderMenu(Zend_Navigation_Container $container,
                                                     $ulClass,
                                                     $indent,
                                                     $minDepth,
                                                     $maxDepth,
                                                     $onlyActive)
                      {
                          // modified code here
                      }
                  }
                  

                  推荐答案

                     $view->addHelperPath(
                        APPLICATION_ROOT . '/library/MyApp/View/Helper/Navigation',
                        'MyApp_View_Helper_'
                        );
                  
                  
                  echo $this->navigation()->myMenu(); // name of your class
                  

                  来自:让 Zend_Navigation 菜单工作使用 jQuery 的鱼眼

                  编辑

                  抱歉,我没有看到您的解决方案,这正是我发布的内容.

                  Sorry I've not seen your solution, it is exactly what I've posted.

                  但为什么这不是菜单类的真正扩展?

                  But why this is not a trully extension of menu class?

                  这篇关于如何扩展 Zend Navigation Menu View Helper?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!
                • 相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <tbody id='RmEM0'></tbody>

                  <i id='RmEM0'><tr id='RmEM0'><dt id='RmEM0'><q id='RmEM0'><span id='RmEM0'><b id='RmEM0'><form id='RmEM0'><ins id='RmEM0'></ins><ul id='RmEM0'></ul><sub id='RmEM0'></sub></form><legend id='RmEM0'></legend><bdo id='RmEM0'><pre id='RmEM0'><center id='RmEM0'></center></pre></bdo></b><th id='RmEM0'></th></span></q></dt></tr></i><div id='RmEM0'><tfoot id='RmEM0'></tfoot><dl id='RmEM0'><fieldset id='RmEM0'></fieldset></dl></div>

                        <small id='RmEM0'></small><noframes id='RmEM0'>

                          <bdo id='RmEM0'></bdo><ul id='RmEM0'></ul>
                          <legend id='RmEM0'><style id='RmEM0'><dir id='RmEM0'><q id='RmEM0'></q></dir></style></legend>
                          • <tfoot id='RmEM0'></tfoot>