【发布时间】:2017-07-21 06:52:04
【问题描述】:
我的菜单结构是这样的
Customer
添加估算 = url = index.php?r=estimate/estimate/create&entity_type=customer
管理估算 = url = index.php?r=estimate/estimate/index&entity_type=customer
Lead
添加估算 = url = index.php?r=estimate/estimate/create&entity_type=lead
管理估计= url = index.php?r=estimate/estimate/create&entity_type=lead
我想通过检查来制作活动菜单
“create&entity_type=lead or customer”和“index&entity_type=lead or customer”部分的url。
如果我将完整的 url 添加到数组列表以匹配它会使两个菜单项都处于活动状态。 TIA 寻求帮助
到目前为止我的尝试
function activeMenu($link){
return $_GET['r']==$link?'active':'';
}
<li class="<?=activeMenu('estimate/estimate/create&entity_type=customer')?>">
<a href="index.php?r=estimate/estimate/create&entity_type=customer"><?php echo Yii::t('app', 'Add Estimate');?> </a>
</li>
【问题讨论】: