duanniedang3946 2014-06-05 23:57
浏览 28
已采纳

如果启用了捆绑包,添加菜单链接的好方法是什么?

I'm developing an Application in Symfony2 (twig templating) which will involve multiple bundles some of which may be swapped out in place of others. Each bundle will provide certain URLs and functionality at that URL.

What is a good practice for building up a menu full of links depending on what bundles are enabled?

My first thought is using twig to embed a controller that will check the kernel.bundles parameter and depending on that list build a menu on it. But I also may have to have sub navigation links open if the parent link is selected and I'm unsure as how to implement this yet.

  • 写回答

1条回答 默认 最新

  • doufan2541 2014-06-06 06:01
    关注

    For menus in general, you should have a look at the KnpMenuBundle.

    About your bundle problematic: I would suggest an approach with tagged services.

    Every bundle could contain a submenu service, that is tagged. In your main menu implementation you could have a menu registry, that collects all those tagged services.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效