묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
@if 조건문...사용방법 여쭤봅니다
2014.06.14 20:37
네비게이션에서 2차메뉴가 있으면 X, 없으면 Y이런 조건을 만들려고 하는데 제가 어떻게 해야하는지 몰라서 이리저리 해보다가 안되어 여쭤봅니다 ^^;
2차메뉴가 있으면 왼쪽에 서브메뉴가 (col-lg-2) 뜨고 우측에 컨텐츠 (col-lg-10)이 뜨는데, 2차메뉴가 없는 경우 서브메뉴가 안뜨게하고 (hidden) 우측 컨텐츠가 (col-lg-12)로 바뀌는 형식을 만들려고 합니다..
아래 소스 붙이니 고수님들 고견 부탁드립니다^^
<!--@if(!$val2['list'] && !$val2['selected'])--> <block cond="$layout_info->LAYOUT_TYPE=='SUB_PAGE'"> <div class="col-lg-2" style="padding-left: 0;"> <ul loop="$global_menu->list=>$key1,$val1" cond="$val1['selected'] && $val1['list']" class="list-group"> <li loop="$val1['list']=>$key2,$val2" class="active"|cond="$val2['selected']"><a href="{$val2['href']}" target="_blank"|cond="$val2['open_window']=='Y'">{$val2['link']}</a> <ul cond="$val2['list']"> <li loop="$val2['list']=>$key3,$val3" class="active"|cond="$val3['selected']"><a href="{$val3['href']}" target="_blank"|cond="$val3['open_window']=='Y'">{$val3['link']}</a> </li> </ul> </li> </ul> </div> <div class="col-lg-10">{$content}</div> </block> <!--@else--> <block cond="$layout_info->LAYOUT_TYPE=='SUB_PAGE'"> <div class="hidden"> <ul loop="$global_menu->list=>$key1,$val1" cond="$val1['selected'] && $val1['list']" class="list-group"> <li loop="$val1['list']=>$key2,$val2" class="active"|cond="$val2['selected']"><a href="{$val2['href']}" target="_blank"|cond="$val2['open_window']=='Y'">{$val2['link']}</a> <ul cond="$val2['list']"> <li loop="$val2['list']=>$key3,$val3" class="active"|cond="$val3['selected']"><a href="{$val3['href']}" target="_blank"|cond="$val3['open_window']=='Y'">{$val3['link']}</a> </li> </ul> </li> </ul> </div> <div class="col-lg-12">{$content}</div> </block> <!--@end-->
댓글 4
-
mAKEkr
2014.06.14 22:12
-
RedLan
2014.06.15 02:57
@if 앞에 @foreach 로 ... 루프 문을 먼저 돌리셔야 할거 같습니다.
-
mr33
2014.06.15 09:27
감사합니다. @foreach 에 뭐라고 써야지 작동할까요?? ^^;
-
mr33
2014.06.15 21:01
이리저리 해봐도 안되네요;; 혹시 도움 주실 수 있다면 감사하겠습니다^^;
<!--@foreach($global_menu->list as $val1)--> <!--@if($val1->list)--> <!--@foreach($val1->list as $val2)--> <!--@if($val2['list'] && $val2['selected'])--> <block cond="$layout_info->LAYOUT_TYPE=='SUB_PAGE'"> <div class="col-lg-2" style="padding-left: 0;"> <ul loop="$global_menu->list=>$key1,$val1" cond="$val1['selected'] && $val1['list']" class="list-group"> <li loop="$val1['list']=>$key2,$val2" class="active"|cond="$val2['selected']"><a href="{$val2['href']}" target="_blank"|cond="$val2['open_window']=='Y'">{$val2['link']}</a> <ul cond="$val2['list']"> <li loop="$val2['list']=>$key3,$val3" class="active"|cond="$val3['selected']"><a href="{$val3['href']}" target="_blank"|cond="$val3['open_window']=='Y'">{$val3['link']}</a> </li> </ul> </li> </ul> </div> <div class="col-lg-10">{$content}</div> </block> <!--@else--> <block cond="$layout_info->LAYOUT_TYPE=='SUB_PAGE'"> <div class="hidden"> <ul loop="$global_menu->list=>$key1,$val1" cond="$val1['selected'] && $val1['list']" class="list-group"> <li loop="$val1['list']=>$key2,$val2" class="active"|cond="$val2['selected']"><a href="{$val2['href']}" target="_blank"|cond="$val2['open_window']=='Y'">{$val2['link']}</a> <ul cond="$val2['list']"> <li loop="$val2['list']=>$key3,$val3" class="active"|cond="$val3['selected']"><a href="{$val3['href']}" target="_blank"|cond="$val3['open_window']=='Y'">{$val3['link']}</a> </li> </ul> </li> </ul> </div> <div class="col-lg-12">{$content}</div> </block> <!--@end--> <!--@end--> <!--@end--> <!--@end-->
1차의 loop부분부터 올려주셔야 맞는것같아요.