jizhicms 后台侧边导航没权限不显示

曹え 5811 发布于:2024-10-11 03:50:10

使用说明:角色权限选择必须勾选子菜单,只勾选父级是不行的,替换模版侧边的列表:

		{if(is_array($left_layout))}
		{foreach $left_layout as $v}
            <li>
                <a href="javascript:;">
                    <i class="iconfont">{fun htmlspecialchars_decode($v['icon'])}</i>
					{fun JZLANG($v['name'])}
                    <i class="iconfont nav_right">&#xe6a7;</i>
                </a>
                <ul class="sub-menu">
				{foreach $v['nav'] as $vv}
				{if(!is_array($vv) && $vv)}
                    <li>
						{if(strpos($vv,'class')!==false)}
						<a _href="{$classnav[$vv]['act']}" >{$classnav[$vv]['classname']}</a>
						{else}
                            {if(strpos($admin['paction'],','.$actions[$vv]['fc'].',')!==false || $admin['gid']==1)}
                            <a _href="{fun U($actions[$vv]['fc'])}">{fun JZLANG($actions[$vv]['name'])}</a>
                            {/if}
						{/if}
                    </li >
				{else if(is_array($vv))}
					
					<li>
						{if(strpos($vv['value'],'class')!==false)}
						<a _href="{$classnav[$vv['value']]['act']}" >{if($vv['icon'])}<i class="iconfont">{fun htmlspecialchars_decode($vv['icon'])}</i>{/if}{fun JZLANG($vv['title'])}</a>
						{else}
						{if(strpos($admin['paction'],','.$actions[$vv['value']]['fc'].',')!==false  || $admin['gid']==1)}
                        <a _href="{fun U($actions[$vv['value']]['fc'])}">{if($vv['icon'])}<i class="iconfont">{fun htmlspecialchars_decode($vv['icon'])}</i>{/if}{fun JZLANG($vv['title'])}</a>
                        {/if}
						{/if}
                    </li>
					
					
				{/if}
                {/foreach}    
                    
                </ul>
            </li>
			
		{/foreach}	
		{/if}	


代码说明:

{if(strpos($admin['paction'],','.$actions[$vv['value']]['fc'].',')!==false  || $admin['gid']==1)}
                        <a _href="{fun U($actions[$vv['value']]['fc'])}">{if($vv['icon'])}<i class="iconfont">{fun htmlspecialchars_decode($vv['icon'])}</i>{/if}{fun JZLANG($vv['title'])}</a>
                        {/if}


strpos($admin['paction'],','.$actions[$vv['value']]['fc'].',')!==false

这行是判断权限中是否包含当前菜单


$admin['gid']==1

这个是超级管理员直接显示

觉得有用请点个赞吧!
0 105