<?php 
// 1단계 분류
$hsql = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where length(ca_id) = '2' and ca_use = '1' order by ca_id "; 
$hresult = sql_query($hsql); 
$count = count($hresult); 
for ($i=0; $row=sql_fetch_array($hresult); $i++) { 
?> 
	<div class="lnb-box"> 
		<h2><a href="<?php echo G5_SHOP_URL.'/list.php?ca_id='.$row['ca_id']; ?>"><?php echo $row['ca_name']; ?></a></h2>
		<?php 
		// 2단계 분류
		$sql2 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where LENGTH(ca_id) = '4' and SUBSTRING(ca_id,1,2) = '{$row['ca_id']}' and ca_use = '1' order by ca_id "; 
		$result2 = sql_query($sql2); 

		for ($j=0; $row2=sql_fetch_array($result2); $j++) { 
			if ($j==0) echo '<ul>'; 
			$active = $row2['ca_id'] == substr($_GET['ca_id'], 0, 4) ? "class='active'" : "";

		?> 
		<li <?php echo $active?>><a href="<?php echo G5_SHOP_URL; ?>/list.php?ca_id=<?php echo $row2['ca_id']; ?>"><?php echo $row2['ca_name']; ?></a></li> 
		<?php } 
			if ($j>0) echo '</ul>'; 
		?> 
	</div>
<?php } ?>

'PROGRAM > PHP' 카테고리의 다른 글

서브 타이틀, 네비게이션  (0) 2017.03.21
무료 보안서버 모듈  (0) 2015.06.02
PHP 브라우저 확인  (0) 2014.05.07
모바일에서만 나오게  (0) 2014.03.20
정해진 범위안에서 셔플  (0) 2014.02.26