Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZendFramework]Zend_Navigation + Zend_Router problem
R4D3K
post
Post #1





Grupa: Zarejestrowani
Postów: 144
Pomógł: 12
Dołączył: 16.03.2007

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


Witam wszystkich, ostatnio zacząłem używać Zend_Navigation. I posiadam następujący bootstrap:
  1. <?php
  2.  
  3. class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
  4. {
  5. protected function _initViewHelpers() {
  6. $this->bootstrap('layout');
  7. $layout = $this->getResource('layout');
  8. $view = $layout->getView();
  9. //init doctype
  10. $view->doctype('XHTML1_STRICT');
  11. //init Zend_Navigation
  12. $configNav = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml','main');
  13. $view->navigation(new Zend_Navigation($configNav));
  14. //init Zend_Router
  15. $configRoute = new Zend_Config_Xml(APPLICATION_PATH . '/configs/route.xml','route');
  16. $router = Zend_Controller_Front::getInstance()->getRouter();
  17. $router->addConfig($configRoute);
  18. }
  19.  
  20. }


Oraz pliki xml:

navigation.xml:
Kod
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <main>
      <start>
          <label>START</label>
          <controller>index</controller>
          <action>start</action>
      </start>

      <imprezy>
          <label>IMPREZY</label>
          <controller>index</controller>
          <action>imprezy</action>
      </imprezy>

      <oferta>
          <label>OFERTA</label>
          <controller>index</controller>
          <action>oferta</action>
      </oferta>

      <galeria>
          <label>GALERIA</label>
          <controller>index</controller>
          <action>galeria</action>
      </galeria>

      <kontakt>
          <label>KONTAKT</label>
          <controller>index</controller>
          <action>kontakt</action>
      </kontakt>
  </main>
</root>


Oraz, route.xml:

Kod
<?xml version="1.0" encoding="UTF-8"?>
<root>
<main>
    <imprezy type="Zend_Controller_Router_Route_Static">
        <route>imprezy.html</route>
        <defaults>
            <controller>index</controller>
            <action>imprezy</action>
        </defaults>
    </imprezy>
    <oferta type="Zend_Controller_Router_Route_Static">
        <route>oferta.html</route>
        <defaults>
            <controller>index</controller>
            <action>oferta</action>
        </defaults>
    </oferta>
    <oferta type="Zend_Controller_Router_Route_Static">
        <route>oferta.html</route>
        <defaults>
            <controller>index</controller>
            <action>oferta</action>
        </defaults>
    </oferta>
    <kontakt type="Zend_Controller_Router_Route_Static">
        <route>kontakt.html</route>
        <defaults>
            <controller>index</controller>
            <action>kontakt</action>
        </defaults>
    </kontakt>
</main>
</root>


A problem jest generowanie linków przez Zend_Navigation, za chiny nie mogę znaleźć w dokumentacji oraz w necie w jaki sposób zmusić Zend_Navigation do generowania tras, które zdefiniowałem w route.xml. Czy jest jakiś sposób na zdefiniowanie np w navigation.xml nazwy trasy, która będzie używana ?
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 24.12.2025 - 02:56