dpvmjk0479 2015-10-04 12:45
浏览 20
已采纳

CakePHP访问插件控制器

Ok, so I am using a ReportManager plugin. I am able to use it as is by using this url: 'localhost/AppName/report_manager/reports'

Now, when I try to use it on the project I'm working on, I have a problem with accessing the plugin's controller.

I have a side bar which contains several links. Here's the code:

<div id="wrapper">
    <!-- Sidebar -->
    <div id="sidebar-wrapper">
        <ul class="sidebar-nav">
            <li id="sidebar-header">
                <?php
                    echo $this->Html->link(
                    'Home',
                        array(
                        'controller' => 'members',
                        'action' => 'index',

                        )
                    );
                ?>
            </li>
            <li id="sidebar-header">
                <?php
                    echo $this->Html->link(
                    'Messages',
                        array(
                        'controller' => 'members',
                        'action' => 'messages',

                        )
                    );
                ?>
            </li>

            <li id="sidebar-header">Misc</li>        
            <li>
                <?php
                    echo $this->Html->link(
                    'Received Documents',
                        array(
                        'controller' => 'members',
                        'action' => 'documents',

                        )
                    );
                ?>
            </li>

            <li id="sidebar-header">
                <?php
                    echo $this->Html->link(
                    'Calendar',
                        array(
                        'controller' => 'calendars',
                        'action' => 'calendar',

                        )
                    );
                ?>
            </li>
            <li>
                <?php
                    echo $this->Html->link(
                    'Manage Events',
                        array(
                        'controller' => 'events',
                        'action' => 'manage',

                        )
                    );
                ?>
            </li>

            <li id="sidebar-header">
                <?php
                    echo $this->Html->link(
                    'Reports',
                        array(
                        'controller' => 'reports',
                        'action' => 'index',

                        )
                    );
                ?>
            </li>

            <center><hr class="item-divider"></center>

            <li id="sidebar-header">
                <?php
                    echo $this->Html->link(
                    'Manage Accounts',
                        array(
                        'controller' => 'members',
                        'action' => 'manage_accounts',

                        )
                    );
                ?>
            </li>

            <li id="sidebar-header">
                <?php
                    echo $this->Html->link(
                    'Logout',
                        array(
                        'controller' => 'user',
                        'action' => 'logout',

                        )
                    );
                ?>
            </li>

        </ul>  
    </div>
</div>

So I have a link name 'Reports' that would open the ReportsManager plugin. So far I cannot figure it out how to access it.

I tried this one:

<li id="sidebar-header">
      <?php
          echo $this->Html->link(
         'Reports',
            array(
              'controller' => 'report_manager/reports',
              'action' => 'index',                          
                 )
          );
       ?>
 </li>

It works, but once you click other links you will see this on the url: 'localhost/AppName/report_manager/members/documents'

Any way I can fix this?

  • 写回答

1条回答 默认 最新

  • doumian3780 2015-10-04 15:29
    关注

    Add 'plugin' => 'PLUGIN NAME HERE'

    <li id="sidebar-header">
      <?php
          echo $this->Html->link(
         'Reports',
            array(
              'plugin' => 'report_manager',
              'controller' => 'reports',
              'action' => 'index',                          
                 )
          );
       ?>
    

    Other links 'plugin' => false

    <?php
        echo $this->Html->link(
          'Home',
           array(
              'plugin' => false,
              'controller' => 'members',
              'action' => 'index',
           )
        );
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题