Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [ZendFramework]Zend_Navigation i moduły problem
elita4all
post 5.07.2011, 21:13:45
Post #1





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 28.10.2009

Ostrzeżenie: (0%)
-----


w pasku adresu mam http://lp14.pp/public/admin
w init mam menu

CODE
class Admin_IndexController extends Zend_Controller_Action
{

public function init()
{

$menu=array (array(
'label' => 'Strona glowna',
'action' => 'index',
'controller' => 'index',
'module' => 'admin' ));
$navigation = new Zend_Navigation($menu);
$this->view->navigation($navigation);

}

w views mam
CODE
<?php echo $this->navigation()->menu(); ?>


a jak najeżdżam na linka to adres jest http:///public/admin
co i gdzie trza ustawić?
P.S. oczywiście jak widać jestem very początkujący

Ten post edytował elita4all 5.07.2011, 21:14:43
Go to the top of the page
+Quote Post
KrzysiekWildfire
post 8.07.2011, 17:05:11
Post #2





Grupa: Zarejestrowani
Postów: 93
Pomógł: 11
Dołączył: 27.10.2010
Skąd: Kutno/Poznań

Ostrzeżenie: (0%)
-----


Ja opieram nawigację o xml'a:
  1. <?xml version="1.0"?>
  2. <zend-config xmlns:zf="http://framework.zend.com/xml/zend-config-xml/1.0/">
  3. <nav>
  4. <start>
  5. <label>Start</label>
  6. <uri>/</uri>
  7. <route>default</route>
  8. <pages>
  9. <home>
  10. <label>Start</label>
  11. <uri>/</uri>
  12. <route>default</route>
  13. </home>
  14. <artykuly>
  15. <label>Artykuły</label>
  16. <visible>0</visible>
  17. <module>artykuly</module>
  18. <controller>show</controller>
  19. </artykuly>
  20. <ofirmie>
  21. <label>O firmie</label>
  22. <module>pages</module>
  23. <route>ofirmie</route>
  24. <params>
  25. <id>2</id>
  26. </params>
  27. </ofirmie>
  28. <polityka>
  29. <label>Polityka prywatności</label>
  30. <module>pages</module>
  31. <route>politykaprywatnosci</route>
  32. <visible>0</visible>
  33. <params>
  34. <id>6</id>
  35. </params>
  36. </polityka>
  37. <oferta>
  38. <label>Oferta</label>
  39. <module>pages</module>
  40. <route>oferta</route>
  41. <params>
  42. <id>3</id>
  43. </params>
  44. </oferta>
  45. <wspolpraca>
  46. <label>Współpraca</label>
  47. <module>pages</module>
  48. <route>wspolpraca</route>
  49. <params>
  50. <id>4</id>
  51. </params>
  52. </wspolpraca>
  53. <kalkulator>
  54. <label>Kalkulator</label>
  55. <module>kalkulator</module>
  56. <controller>index</controller>
  57. <action>index</action>
  58. <visible>0</visible>
  59. <route>default</route>
  60. <pages>
  61. <edit>
  62. <label>Artykuł</label>
  63. <module>kalkulator</module>
  64. <controller>index</controller>
  65. <action>show</action>
  66. <visible>0</visible>
  67. <route>kalkulator</route>
  68. </edit>
  69. </pages>
  70. </kalkulator>
  71. <porady>
  72. <label>Porady</label>
  73. <module>porady</module>
  74. <controller>index</controller>
  75. <action>index</action>
  76. <route>default</route>
  77. <pages>
  78. <porada>
  79. <label>Wpis</label>
  80. <module>porady</module>
  81. <controller>index</controller>
  82. <action>show</action>
  83. <visible>0</visible>
  84. </porada>
  85. </pages>
  86. </porady>
  87. <blog>
  88. <label>Blog</label>
  89. <module>blog</module>
  90. <controller>index</controller>
  91. <action>index</action>
  92. <route>blog</route>
  93. <pages>
  94. <blogwpis>
  95. <label>Wpis</label>
  96. <module>blog</module>
  97. <controller>show</controller>
  98. <action>index</action>
  99. <visible>0</visible>
  100. </blogwpis>
  101. </pages>
  102. </blog>
  103. <kontakt>
  104. <label>Kontakt</label>
  105. <controller>kontakt</controller>
  106. <action>index</action>
  107. <route>default</route>
  108. </kontakt>
  109. <wyszukiwanie>
  110. <label>Wyszukiwanie</label>
  111. <module>szukaj</module>
  112. <visible>0</visible>
  113. <route>default</route>
  114. </wyszukiwanie>
  115. </pages>
  116. </start>
  117. </nav>
  118. </zend-config>


W php wczytuję to tak:
  1. $navigationConfig = new Zend_Config_Xml(APPLICATION_PATH.'/configs/navigation.xml','nav');
  2. $navigation = new Zend_Navigation($navigationConfig->toArray());
  3. Zend_Registry::set('Zend_Navigation',$navigation);

No i w widoku to samo co Ty tam masz.

Pozdro i rzyczę sukcesów
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 20.06.2024 - 04:15