메뉴 - 대메뉴 바로가기
본문
안녕하세요.
대메뉴에서 클릭시 1분류 바로가기 하려고 합니다.
지금 2분류 눌려야 넘어가는 방식으로 되는데 어디 부분을 고쳐야 할까요?
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
function get_mshop_category($ca_id, $len=2, $limit= null)
{
global $g5;
$sql = " select ca_id, ca_name from {$g5['g5_shop_category_table']}
where ca_use = '1' ";
if($ca_id)
$sql .= " and ca_id like '$ca_id%' ";
$sql .= " and length(ca_id) = '$len' order by ca_order, ca_id ";
if($limit) {
$sql .= " limit ". (int)$limit;
}
return $sql;
}
?>
<div id="category">
<div class="cate_close">
<button type="button" class="close_btn"><i class="fa fa-times" aria-hidden="true"></i> 전체카테고리<span class="sound_only">닫기</span></button>
</div>
<div class="cate_area">
<div class="inner">
<div class="cate_side_close">
<img src="<?php echo G5_THEME_IMG_URL?>/common/category_close.png" alt="">
</div>
<div class="ct_wr">
<div class=cate_tit>
<p>카테고리</p>
</div>
<?php
$mshop_ca_href = G5_SHOP_URL.'/list.php?ca_id=';
$mshop_ca_res1 = sql_query(get_mshop_category('', 2, 7));
for($i=0; $mshop_ca_row1=sql_fetch_array($mshop_ca_res1); $i++) {
if($i == 0)
echo '<ul class="cate">'.PHP_EOL;
?>
<li class="cate_li_1">
<a class="cate_main_link cate_link<?php echo $i ?>" href="javascript:;" class="cate_li_1_a"><?php echo get_text($mshop_ca_row1['ca_name']); ?></a>
<?php
$mshop_ca_res2 = sql_query(get_mshop_category($mshop_ca_row1['ca_id'], 4));
for($j=0; $mshop_ca_row2=sql_fetch_array($mshop_ca_res2); $j++) {
if($j == 0)
echo '<ul class="sub_cate sub_cate1">'.PHP_EOL;
?>
<li class="cate_li_2">
<a href="<?php echo $mshop_ca_href.$mshop_ca_row2['ca_id']; ?>"><?php echo get_text($mshop_ca_row2['ca_name']); ?></a>
</li>
<?php
}
if($j > 0)
echo '</ul>'.PHP_EOL;
?>
</li>
<?php
}
if($i > 0)
echo '</ul>'.PHP_EOL;
else
echo '<p class="no-cate">등록된 분류가 없습니다.</p>'.PHP_EOL;
?>
</div>
<div class="cate_except">
<div class="clearfix cate_btm">
<div class="cate_ex_list">
<div class="cate_tit">
<p>그외메뉴</p>
</div>
<ul class="cate_ex_menu clearfix">
<li class="except_item"><a href="javascript:;">커뮤니티</a></li>
<li class="except_item"><a href="javascript:;">고객지원</a></li>
<li class="except_item"><a href="javascript:;">기타</a></li>
</ul>
</div>
<div class="cate_bn_part">
<?php echo display_banner('카테고리', 'mainbanner.50.skin.php'); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function (){
$(window).load(function(){
$('#aside .cate > li').on('click', function(){
$( this ).addClass('active').siblings().removeClass('active');
var a= $(this).find(".sub_cate").outerHeight();
$("#category .ct_wr").css("margin-bottom",a+30)
});
});
var $category = $("#category");
$("#menu_open").on("click", function() {
$category.css("display","block");
});
$("#category .close_btn , .cate_side_close").on("click", function(){
$category.css("display","none");
});
});
$(document).mouseup(function (e){
var container = $("#category");
if( container.has(e.target).length === 0)
container.hide();
});
</script>
<script>
</script>
답변 1
for($i=0; $mshop_ca_row1=sql_fetch_array($mshop_ca_res1); $i++) { if($i == 0) echo '<ul class="cate">'.PHP_EOL; ?> <li class="cate_li_1"> <a class="cate_main_link cate_link<?php echo $i ?>" href="
<?php echo $mshop_ca_href.$mshop_ca_row1['ca_id']; ?>" class="cate_li_1_a"><?php echo get_text($mshop_ca_row1['ca_name']); ?></a> 여기 href를 이렇게 바꾸면 되지 않을까요?
답변을 작성하시기 전에 로그인 해주세요.