상품분류메뉴 active 처리문제
본문
eyekiss님이 가르쳐 주신 부분 응용 하고 있습니다.
상품분류메뉴 적용부분
active 활성화 부분입니다.
$mshop_ca_href.$mshop_ca_row1 이부분을 대체했는데
메뉴 하나만 변해야 되는데
active class 가 메뉴마다 다 같은책으로 변하네요 ~!
뭐가 또 틀렸나 ~!
고수님들께 검사 받사 받아야 될것 같습니다.
<?php
$mshop_ca_href = G5_SHOP_URL.'/list.php?ca_id=';
$mshop_ca_res1 = sql_query(get_mshop_category('', 2));
for($i=0; $mshop_ca_row1=sql_fetch_array($mshop_ca_res1); $i++) {
if($i == 0)
// echo '<ul class="nav navbar-nav navbar-right">'.PHP_EOL;
?>
<?php
$active = '';
if($bo_table) {
if(strpos($mshop_ca_href.$mshop_ca_row1['ca_id'], 'bo_table='.$bo_table) !== false) {
$active = ' active';
}
} else if(strpos($mshop_ca_href.$mshop_ca_row1['ca_id'], $_SERVER['PHP_SELF']) !== false) {
$active = ' active';
}
echo "<li class='dropdown{$active}'>".PHP_EOL;
?>
<a href="<?php echo $mshop_ca_href.$mshop_ca_row1['ca_id']; ?>"><?php echo get_text($mshop_ca_row1['ca_name']); ?>
<?php
if ($i != 0 && $i != 4 && $i != 5) {
echo "<i class='fa fa-angle-down'></i>".PHP_EOL;
}
?>
</a>
<!--add role menu -->
<?php
if($i != 0 && $i != 4 && $i != 5)
echo '<ul>'.PHP_EOL;
else
echo '<ul role="menu" class="sub-menu">'.PHP_EOL;
?>
<?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="cate-ul-2" style="margin:0;padding:0;">'.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>
<?php
$mshop_ca_res3 = sql_query(get_mshop_category($mshop_ca_row2['ca_id'], 6));
for($k=0; $mshop_ca_row3=sql_fetch_array($mshop_ca_res3); $k++) {
if($k == 0)
echo '<ul class="cate-ul-3">'.PHP_EOL;
?>
<li class="cate-li-3">
<a href="<?php echo $mshop_ca_href.$mshop_ca_row3['ca_id']; ?>"><?php echo get_text($mshop_ca_row3['ca_name']); ?></a>
<?php
$mshop_ca_res4 = sql_query(get_mshop_category($mshop_ca_row3['ca_id'], 8));
for($m=0; $mshop_ca_row4=sql_fetch_array($mshop_ca_res4); $m++) {
if($m == 0)
echo '<ul class="cate-ul-4">'.PHP_EOL;
?>
<li class="cate-li-4">
<a href="<?php echo $mshop_ca_href.$mshop_ca_row4['ca_id']; ?>"><?php echo get_text($mshop_ca_row4['ca_name']); ?></a>
<?php
$mshop_ca_res5 = sql_query(get_mshop_category($mshop_ca_row4['ca_id'], 10));
for($n=0; $mshop_ca_row5=sql_fetch_array($mshop_ca_res5); $n++) {
if($n == 0)
echo '<ul class="cate-ul-5">'.PHP_EOL;
?>
<li class="cate-li-5">
<a href="<?php echo $mshop_ca_href.$mshop_ca_row5['ca_id']; ?>"><?php echo get_text($mshop_ca_row5['ca_name']); ?></a>
</li>
<?php
}
if($n > 0)
echo '</ul>'.PHP_EOL;
?>
</li>
<?php
}
if($m > 0)
echo '</ul>'.PHP_EOL;
?>
</li>
<?php
}
if($k > 0)
echo '</ul>'.PHP_EOL;
?>
</li>
<?php
}
if($j > 0)
echo '</ul>'.PHP_EOL;
?>
</ul>
<!--add role menu end -->
</li>
<?php
}
if($i > 0)
echo '</ul>'.PHP_EOL;
else
echo '<p>등록된 분류가 없습니다.</p>'.PHP_EOL;
?>
답변을 작성하시기 전에 로그인 해주세요.