지운아빠

영카트5 단계별 하위카테고리 모두 보여주기

==================================================================

skin/shop/~/listcategory.skin.php

==================================================================

급하게 필요해서 하나 만들어봤습니다.
발코딩이니... 오류가 나면... 그러려니 해주세요.

[code]<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$str = '';
$ca_id_len = strlen($ca_id);

// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0);

$ca_cnt = $ca_id_len / 2; // 루프횟수

for ($i=0;$i<$ca_cnt;$i++) {

switch ($i) {
case 3:
$str_len = 8; // like '{$ca_id}%'
$get_len = 10; // length(ca_id)
break;
case 2:
$str_len = 6;
$get_len = 8;
break;
case 1:
$str_len = 4;
$get_len = 6;
break;
case 0:
$str_len = 2;
$get_len = 4;
break;
}

$str = substr($ca_id, 0, $str_len);

echo getMsCategory($str, $get_len, $i, $ca_id);

}

function getMsCategory($ca_id_str, $len, $no, $ca_id) {
global $g5;

$sql = "
select ca_id, ca_name from {$g5['g5_shop_category_table']}
where ca_id like '{$ca_id_str}%' and length(ca_id) = {$len} and ca_use = '1'
order by ca_order, ca_id ";

$result = sql_query($sql);

$str = '<div class="sct-ct sct-ct'.$no.'">';

while ($row=sql_fetch_array($result)) {
if (preg_match("/^{$row['ca_id']}/", $ca_id))
$sct_ct_here = 'sct-ct-here';
else
$sct_ct_here = '';
$str .= '<a href="./list.php?ca_id='.$row['ca_id'].'" class="'.$sct_ct_here.'">'.$row['ca_name'].'</a>';

if ($str) $exists = true;
else $exists = false;
}

$str .= '</div>';

if ($exists) return $str;
else return false;
}
?>[/code]

활성화 된 카테고리는 .sct-ct-here 로 스타일을 지정하시면 됩니다.


##########

영카트 패치가 많이 밀렸을 땐?

http://minsup.kr/ms-item.php?pds_id=30

##########
|

댓글 2개

10년 전
좋아요
댓글을 작성하시려면 로그인이 필요합니다.

영카트5 팁자료실

+
제목 글쓴이 날짜 조회
10년 전 조회 6,131
10년 전 조회 6,943
10년 전 조회 7,997
10년 전 조회 6,389
10년 전 조회 6,510
10년 전 조회 6,785
10년 전 조회 8,390
10년 전 조회 6,030
10년 전 조회 5,634
10년 전 조회 8,763
10년 전 조회 1만
10년 전 조회 7,594
10년 전 조회 1.4만
10년 전 조회 1.3만
10년 전 조회 7,296
10년 전 조회 4,715
10년 전 조회 5,992
10년 전 조회 6,534
10년 전 조회 6,729
10년 전 조회 5,504
10년 전 조회 6,018
10년 전 조회 5,525
10년 전 조회 5,393
10년 전 조회 5,672
10년 전 조회 7,033
10년 전 조회 5,695
10년 전 조회 3,496
10년 전 조회 3,159
10년 전 조회 7,010
10년 전 조회 8,246