douzhi1879 2014-03-08 09:05
浏览 22
已采纳

链接不适用于仪表板,但另一个链接正在工作

in layout/default.ctp i done code like this but working fine page but in Dashboard link was not working but shows on move over i found the url

 <?php if ($this->Session->read('Auth.User')): ?>  
    <?php echo $this->Html->link('Dashboard','/Dashboard/index', array('controller' => 'Dashboard', 'action' => 'index','class'=>'classname')); ?> &nbsp;     
    <?php echo $this->Html->link('logout','/users/logout', array('controller' => 'users', 'action' => 'logout','class'=>'classname')); ?>
<?php else: ?>
    <?php echo $this->Html->link('Register', '/users/add',array('controller' => 'users', 'action' => 'add','class'=>'classname')); ?>&nbsp;
    <?php echo $this->Html->link('login', '/users/login',array('controller' => 'users', 'action' => 'login','class'=>'classname')); ?>
<?php endif; ?>
  • 写回答

1条回答 默认 最新

  • duanbo2048 2014-03-08 09:21
    关注

    If the Dashboard is one of your controller you have, you have to use dashboards if it is DashboardsController.php, if it is DashboardController, use dashboard in the controller variable in the below code, I think you need to fix some other issues too please see the code difference between the below code and yours.

     <?php 
                 if ($this->Session->read('Auth.User')): ?>
    
           <?php echo $this->Html->link('Dashboard', array('controller' => 'dashboards', 'action' => 'index'), array('class'=>'classname')); ?> &nbsp;     
           <?php echo $this->Html->link('logout', array('controller' => 'users', 'action' => 'logout'), array('class'=>'classname')); ?>
        <?php else: ?>
         <?php echo $this->Html->link('Register', array('controller' => 'users', 'action' => 'add'), array('class'=>'classname')); ?>&nbsp;
            <?php echo $this->Html->link('login', array('controller' => 'users', 'action' => 'login'), array('class'=>'classname')); ?>
        <?php endif; ?>
    

    Try this and tell me if there is anything

    Hope it helps.

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

报告相同问题?

悬赏问题

  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面