2010-01-07 13 views

Odpowiedz

35

Tak. Możesz użyć Zend_Controller_Front::getInstance() w widoku pomocników. Więc można zrobić coś takiego:

class App_Helper_DoSomething extends Zend_View_Helper_Abstract 
{ 
    public function doSomething() 
    { 
     return Zend_Controller_Front::getInstance() 
      ->getRequest() 
      ->getControllerName(); 
    } 
} 

Które będzie drukować bieżącą nazwę kontrolera po nazwie w widoku z:

echo $this->doSomething(); 
+0

w jaki sposób można uzyskać nazwę modułu? czy to jest możliwe? – chrisjlee

+0

chrisjlee: Zend_Controller_Front :: getInstance() -> getRequest() -> getModuleName(); –

Powiązane problemy