doubian19900911 2014-12-01 20:38
浏览 81
已采纳

OctoberCMS边栏无法渲染

I have been trying to get familiar with octobercms, but I've come across an issue I can't seem to resolve. I have a backend controller setup with views etc. Everything works, except that the sidebar isn't loading. Also the tab isn't getting the active state.

http://gyazo.com/25e019c1db34d5807c05ebb4b3277ac7

It should look something like this:

http://gyazo.com/c71a1e1dec7c1e6b81136b313b32da47

Here is a gist with my code: https://gist.github.com/muuknl/fedb8434219c7dbe5d04

If I forgot to give certain information, please let me know and thanks in advance for the help.

  • 写回答

1条回答 默认 最新

  • dongxuan1314 2014-12-02 17:02
    关注

    here is simple solution

    in controller you need to write

    BackendMenu::setContext('Archetypics.Team', 'website', 'team');
    

    refer this https://octobercms.com/docs/backend/controllers-views-ajax#navigation-context

    BackendMenu::setContext('Author.Plugin name', 'Menu code', 'Sub menu code');
    

    you need to write same thing what you have written in plugin.php in registerNavigation() function

    public function registerNavigation()
        {
            return [
                // menu code 
                'website' => [
                    'label'       => 'Website',
                    'url'         => Backend::url('muukrls/archetypics/team'),
                    'icon'        => 'icon-pencil',
                    'permissions' => ['archetypics.*'],
                    'order'       => 500,
    
                    'sideMenu' => [
                        'home' => [
                            'label'       => 'Homepage',
                            'icon'        => 'icon-copy',
                            'url'         => Backend::url('muukrls/archetypics/home'),
                            'permissions' => ['archetypics.home_access'],
                        ],
                        'about' => [
                            'label'       => 'About Page',
                            'icon'        => 'icon-list-ul',
                            'url'         => Backend::url('muukrls/archetypics/about'),
                            'permissions' => ['archetypics.about_access'],
                        ],
    
                        // sub menu code
                        'team' => [
                            'label'       => 'Team Members',
                            'icon'        => 'icon-users',
                            'url'         => Backend::url('muukrls/archetypics/team'),
                            'permissions' => ['archetypics.team_access']
                        ]
                    ]
    
                ]
            ];
        }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器