José de Menezes Soares Neto wrote:
> 
> How to detect a module inside the bootstrap index.php?
> 

You can print the module in the VIEW, not the bootstrap.

   echo $this->bread();

Then you can have a view helper like so:

application/modules/admin/views/helpers/Bread.php
class Zend_View_Helper_Bread
{
    public $view;

    public function setView ( Zend_View_Interface $view )
    {
        $this->view = $view;
    }

    public function Bread ( )
    {
        $front =Zend_Controller_Front::getInstance();
                $module     = $front->getRequest()->getModuleName();
                $controller = $front->getRequest()->getControllerName();
                $action     = $front->getRequest()->getActionName();

                $mod_href   = $this->view->url(array('module'=>$module, 
'controller'=>null      
, 'action'=>null));
                $con_href   = $this->view->url(array('module'=>$module,
'controller'=>$controller, 'action'=>null));
                $act_href   = $this->view->url(array('module'=>$module,
'controller'=>$controller, 'action'=>$action));

                $mod_link   = '[a href="'.$mod_href.'">'.$module.'[/a>';
                $con_link   = '[a href="'.$con_href.'">'.$controller.'[/a>';
                $act_link   = '[a href="'.$act_href.'">'.$action.'[/a>';

                $breadcrumb = '';
                if ($module     != 'default') $breadcrumb .= $mod_link;
                if ($controller != 'index'  ) $breadcrumb .= $breadcrumb == '' 
? $con_link
: ' / '.$con_link;
                if ($action     != 'index'  ) $breadcrumb .= ' / '.$act_link;

                if ($breadcrumb)
                        $breadcrumb = "You are here > ".$breadcrumb;
                else
                        $breadcrumb = "You are home";

        return $breadcrumb;
    }
}

-- 
View this message in context: 
http://www.nabble.com/Detecting-a-module-tp19608244p19614845.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to