migration-112.xml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="migration.112">
  4. <title>Zend Framework 1.12</title>
  5. <para>
  6. When upgrading from a previous release to Zend Framework 1.12 or higher you
  7. should note the following migration notes.
  8. </para>
  9. <sect2 id="migration.12.zend.view.helper.navigation">
  10. <title>Zend_View_Helper_Navigation</title>
  11. <para>
  12. Prior to the 1.12 release, a helper with the name
  13. "My_View_Helper_Navigation_Menu" can not be used, because the proxy
  14. helper returns always the standard view helper
  15. "Zend_View_Helper_Navigation_Menu".
  16. </para>
  17. <para>
  18. Starting from version 1.12, you can use our own navigation helpers
  19. with the name "menu", "breadcrumbs", ...
  20. </para>
  21. <para>
  22. Create your own helper with name "Menu":
  23. </para>
  24. <programlisting language="php"><![CDATA[
  25. class My_View_Helper_Navigation_Menu
  26. extends Zend_View_Helper_Navigation_HelperAbstract
  27. {
  28. public function menu(Zend_Navigation_Container $container = null)
  29. {
  30. if (null !== $container) {
  31. $this->setContainer($container);
  32. }
  33. return $this;
  34. }
  35. public function render(Zend_Navigation_Container $container = null)
  36. {
  37. return '<nav>Example</nav>';
  38. }
  39. }
  40. ]]></programlisting>
  41. <para>
  42. Add the helper path to <classname>Zend_View</classname> in your
  43. Bootstrap class:
  44. </para>
  45. <programlisting language="php"><![CDATA[
  46. protected function _initView()
  47. {
  48. $this->bootstrap('view');
  49. $this->view->addHelperPath(
  50. 'path/to/helper',
  51. 'My_View_Helper_Navigation'
  52. );
  53. }
  54. ]]></programlisting>
  55. <para>
  56. Or add the helper path in your "application.ini" file:
  57. </para>
  58. <programlisting language="ini"><![CDATA[
  59. resources.view.helperPath.My_View_Helper_Navigation = "path/to/helper"
  60. ]]></programlisting>
  61. <para>
  62. The following code is used in a view script:
  63. </para>
  64. <programlisting language="php"><![CDATA[
  65. <?php echo $this->navigation()->menu(); ?>
  66. ]]></programlisting>
  67. <para>
  68. Output:
  69. </para>
  70. <programlisting language="html"><![CDATA[
  71. <nav>Example</nav>
  72. ]]></programlisting>
  73. </sect2>
  74. </sect1>
  75. <!--
  76. vim:se ts=4 sw=4 et:
  77. -->