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',
           )
        );
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
  • ¥20 Vite 打包的 Vue3 组件库,图标无法显示
  • ¥15 php 同步电商平台多个店铺增量订单和订单状态
  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别