ZF2: Get module name (or route) in the application layout for menu highlight

前端 未结 3 1098
庸人自扰
庸人自扰 2021-01-13 01:19

How can I get in ZF2 the current (selected) module name in the application layout? Purpose: My application layout include the main menu of the zf2 app, and every time a modu

3条回答
  •  甜味超标
    2021-01-13 01:30

    Use array_shift instead of array_pop (Kunal Dethe answer):

    $controller = $this->getParam('controller');
    $module_array = explode('\\', $controller);
    $module = array_shift($module_array);
    

提交回复
热议问题