Module Zf2根据加载的模块更改布局

Module Zf2根据加载的模块更改布局,module,zend-framework2,Module,Zend Framework2,我在互联网上搜索了一个多星期,但是我在这上面找不到任何东西 所以我想我要问一个简单的问题: Is it possible to modify the layout depending on loaded modules in zf2? I mean, I have 3 modules: 1. blog 2. admin 3.ads. If i disable the blog from the application.config.php, is it possible fo

我在互联网上搜索了一个多星期,但是我在这上面找不到任何东西

所以我想我要问一个简单的问题:

  Is it possible to modify the layout depending on loaded modules in zf2? 
  I mean, I have 3 modules: 1. blog 2. admin 3.ads. 
  If i disable the blog from the application.config.php, 
 is it possible for the menu part containing the blog pages to dissapear?
例如:

禁用前的菜单:

 | Blog | Admin | Ads
禁用博客后的菜单:

 | Admin | Ads

这可能吗?谢谢你的意见

这很容易实现,因为布局所做的只是呈现给定的导航。您的模块应该只连接到相同的导航配置,并从它们自己的
module.config.php
添加它们的条目。如果模块被禁用,配置将不在那里,因此它将根本不会被呈现。

我手动呈现布局(例如
    • )。我尝试使用zend 2导航,但它不起作用,错误:参数无效:$route必须是非空字符串或null'P.s.很高兴从您那里得到答案,Sam,在网站上到处都能看到您:)谢谢!我现在正在学习zf2,所以我不太擅长。我建议学习zf2