Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZF] Zend_Navigation + Zend_Db_Table - helper, jak pobrać i wyświetlić menu z bazy
mitring
post
Post #1





Grupa: Zarejestrowani
Postów: 78
Pomógł: 1
Dołączył: 4.03.2006

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


Cześć jako początkujący napotykam same problemy (IMG:style_emoticons/default/tongue.gif)

Stworzyłem sobie helpera:
  1. class Zend_View_Helper_NavigationMenu extends Zend_View_Helper_Abstract
  2. {
  3. public function navigationMenu()
  4. {
  5. $dbAdapter = Zend_Db_Table::getDefaultAdapter();
  6. $menuArray = $dbAdapter->fetchAll("SELECT * FROM menu");
  7.  
  8. $navContainer = new Zend_Navigation();
  9.  
  10. foreach ( $menuArray as $value )
  11. {
  12. $navContainer->addPage(
  13. Zend_Navigation_Page::factory( array(
  14. 'uri' => $value['url'],
  15. 'label' => $value['name']
  16. )
  17. )
  18. );
  19. }
  20.  
  21. return $navContainer;
  22. }
  23. }


Kompletnie nie wiem jak jak stworzyć menu przy pomocy Zend_Navigation w helperze i wyświetlić go... mogę prosić o pomoc. Kompletnie się zagubiłem czytając manual zenda

-- edit --
  1. <?php echo $this->navigation($this->navigationMenu())->menu(); ?>


Działa - wyświetla się ale czy jest to poprawne rozwiązanie czy można o jakoś łatwiej zrobić?

Ten post edytował mitring 27.05.2012, 17:31:31
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 25.12.2025 - 18:24