[Tips] 개발-레이아웃-메뉴-권한이있을때만출력하기
2020.05.03 00:49
28
0
https://eond.com/432371
object(HotopayModel)#817 (23) { ["error"]=> int(0) ["message"]=> string(7) "success" ["variables"]=> array(0) { } ["httpStatusCode"]=> int(200) ["module"]=> string(7) "hotopay" ["module_info"]=> NULL ["origin_module_info"]=> NULL ["module_config"]=> NULL ["module_path"]=> string(52) "/home/eond/web/eond.com/public_html/modules/hotopay/" ["xml_info"]=> NULL ["module_srl"]=> NULL ["mid"]=> NULL ["act"]=> NULL ["template_path"]=> NULL ["template_file"]=> NULL ["layout_path"]=> NULL ["layout_file"]=> NULL ["edited_layout_file"]=> NULL ["stop_proc"]=> bool(false) ["user"]=> object(Rhymix\Framework\Helpers\SessionHelper)#816 (20) { ["member_srl"]=> int(0) ["user_id"]=> NULL ["user_name"]=> NULL ["nick_name"]=> NULL ["email_address"]=> NULL ["phone_number"]=> NULL ["homepage"]=> NULL ["blog"]=> NULL ["birthday"]=> NULL ["denied"]=> NULL ["status"]=> NULL ["is_admin"]=> string(1) "N" ["is_site_admin"]=> NULL ["profile_image"]=> NULL ["image_name"]=> NULL ["image_mark"]=> NULL ["signature"]=> NULL ["description"]=> NULL ["group_list"]=> array(0) { } ["menu_list"]=> array(0) { } } ["request"]=> object(Rhymix\Framework\Request)#10 (13) { ["method"]=> string(3) "GET" ["compat_method"]=> string(3) "GET" ["url"]=> string(21) "xe/432371/page/465339" ["hostname"]=> string(8) "eond.com" ["domain"]=> NULL ["protocol"]=> string(5) "https" ["callback_function"]=> string(0) "" ["_route_status":protected]=> int(200) ["_route_options":protected]=> object(stdClass)#11 (5) { ["cache_control"]=> bool(true) ["check_csrf"]=> bool(true) ["is_forwarded"]=> bool(false) ["is_indexable"]=> bool(true) ["enable_session"]=> bool(true) } ["module"]=> string(5) "board" ["mid"]=> string(2) "xe" ["act"]=> string(16) "dispBoardContent" ["args"]=> array(4) { ["document_srl"]=> string(6) "432371" ["page"]=> int(1) ["mid"]=> string(2) "xe" ["act"]=> string(16) "dispBoardContent" } } ["ajaxRequestMethod"]=> array(2) { [0]=> string(6) "XMLRPC" [1]=> string(4) "JSON" } ["gzhandler_enable"]=> bool(true) }

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']" 를 추가해주면 된다.

라이믹스는 이온디와 함께

닫기

마이페이지

로그인을 해주세요

네이버로 로그인