我尝试在文件' /view/top-menu.ctp'中进行循环。 (top-menu.ctp)...根据角色显示链接 例如:
If (roles == Admin) { // I m looking for this condtion ?
<a href='…..'> Admin </ a>
}
答案 0 :(得分:0)
In your loop condition you can write:
<?php if($variable['Model']['field'] == 'Admin'){ ?>
<a href="<?php echo $this->webroot; ?>Controller/function"> Admin </ a>
<?php }else if($variable['Model']['field'] == 'User'){ ?>
<a href="<?php echo $this->webroot; ?>Controller/function">User</ a>
<?php } ?>