r

검색엔진과 같은 카테고리 구성에 대한 질문

· 2003-12-25 (목) 01:36:17 · 1172 · 2
다음처럼 변경해서 사용하세요.
그리고 카테고리 개수를 한줄에 4개가 아닌 다른 갯수로 수정하고 싶으시다면 $colnum = 4; 로 되어있는것을 임의의 갯수로 수정하세요.

function get_category_list($table,$loc)
{
global $cfg, $stext;

$sql = " select * from {$table}_cat order by ca_id ";
$result = sql_query($sql);

if(!$stext){
$str = "<b>[ <a href=$loc><font color=0099cc>전체</font></a> ]</b> ";
} else {
$str = "[ <a href=$loc><font color=0099cc>전체</font></a> ] ";
}
$cnt = 1;
$colnum = 4; // 한줄에 보여주고 싶은 카테고리 개수
while ($row = mysql_fetch_array($result)) {
$brchk = $cnt++%$colnum;
if($stext == $row[ca_id]) $str .= "<b>";
$str .= " [ <a href=$loc$row[ca_id]><font color=0099cc>".get_category_name($table,$row[ca_id])."</font></a> ] ";
if($stext == $row[ca_id]) $str .= "</b>";
if($brchk == $colnum-1) $str .= "<br>";
}
mysql_free_result($result);

return $str;
}
|

댓글 2개

좋은 자료 감사합니다.
감사합니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누3질답

9,564건
+
제목 글쓴이 날짜 조회
03-12-26 조회 376
03-12-26 조회 464
03-12-26 조회 951
03-12-29 조회 859
03-12-29 조회 435
03-12-26 조회 415
03-12-26 조회 515
네네모똘
03-12-26 조회 568
03-12-25 조회 465
03-12-24 조회 610
03-12-24 조회 354
03-12-24 조회 524
03-12-24 조회 524
03-12-25 조회 1,173
03-12-24 조회 748
솔솔로부대
03-12-24 조회 296
03-12-24 조회 333
우우리아빠
03-12-24 조회 582
03-12-24 조회 868
네네모똘
03-12-24 조회 465