1. 수정전

<block loop="$multi_menu1->list => $key1, $val1" cond="$val1['selected']">
   <ul>
      <li loop="$multi_menu1->list => $key1, $val1">
         <a hreaf="{$val1['href']}" class="val1 <!--@if($val1['expand']=='Y'||$val1['selected'])-->on<!--@end-->"><img src="assets/img/{$val1['desc']}.png" alt="" cond="$val1['desc']">{$val1['link']}</a>
         <ul>
            <li loop="$val1['list'] => $key2, $val2"><a href="{$val2['href']}" class="on"|cond="$val2['selected']"><img src="assets/img/{$val2['desc']}.png" alt="" cond="$val2['desc']">{$val2['link']}</a>
               <ul cond="$val2['list']">
                  <li loop="$val2['list'] => $key3, $val3"><a href="{$val3['href']}" class="on"|cond="$val3['selected']">{$val3['link']}</a>
                     <ul cond="$val3['list']">
                        <li loop="$val3['list'] => $key4, $val4"><a href="{$val4['href']}" class="on"|cond="$val4['selected']">{$val4['link']}</a></li>
                     </ul>
                  </li>
               </ul>
            </li>
         </ul>
      </li>
   </ul>           
</block>


2. 수정후

<block loop="$multi_menu1->list => $key1, $val1" cond="$val1['selected']">
   <ul>
      <li loop="$multi_menu1->list => $key1, $val1" cond="$val1['link']">
         <a hreaf="{$val1['href']}" class="val1 <!--@if($val1['expand']=='Y'||$val1['selected'])-->on<!--@end-->"><img src="assets/img/{$val1['desc']}.png" alt="" cond="$val1['desc']">{$val1['link']}</a>
         <ul>
            <li loop="$val1['list'] => $key2, $val2"><a href="{$val2['href']}" class="on"|cond="$val2['selected']"><img src="assets/img/{$val2['desc']}.png" alt="" cond="$val2['desc']">{$val2['link']}</a>
               <ul cond="$val2['list']">
                  <li loop="$val2['list'] => $key3, $val3"><a href="{$val3['href']}" class="on"|cond="$val3['selected']">{$val3['link']}</a>
                     <ul cond="$val3['list']">
                        <li loop="$val3['list'] => $key4, $val4"><a href="{$val4['href']}" class="on"|cond="$val4['selected']">{$val4['link']}</a></li>
                     </ul>
                  </li>
               </ul>
            </li>
         </ul>
      </li>
   </ul>           
</block>

수정전에는 

block > ul > li 

이 구조에 cond="$val1['link']" 가 없어서, 권한이 없더라도 html 돔 구조는 그대로 노출이 되었다.

해당 메뉴에 권한이 없을 경우 해당 li 태그도 출력하지 않고 싶다면

해당 li에 cond="$val1['link']" 를 추가해주면 된다.

추천한 사람

 
댓글은 로그인 사용자만 작성 가능합니다. 로그인하기