그누 기본 게시판에서 카테고리 이용시에 기본적으로 셀렉트 박스로 불러오는데요.
이것을 셀렉트 박스를 이용하지 않고 나열되서 뿌려주게 하는 함수입니다.
그누 기본에 없어서 재가 쓰는것 올려요.
아래 내용을 extend/extend.lib.php 에 추가해주세요
// 펑션 시작
function get_category_list($bo_table='')
{
global $g4, $board;
/*
$sql = " select bo_category_list from $g4[board_table] where bo_table = '$bo_table' ";
$row = sql_fetch($sql);
$arr = explode("|", $row[bo_category_list]); // 구분자가 , 로 되어 있음
*/
$arr = explode("|", $board[bo_category_list]); // 구분자가 , 로 되어 있음
$str = "";
for ($i=0; $i<count($arr); $i++)
if (trim($arr[$i])){
$str .= "<span class=\"sccTitle_Text\"><a href=\"?bo_table=$bo_table&sca={$arr[$i]}\"><strong>{$arr[$i]}</strong></a></span>";
if($i + 1 != count($arr)){
$str .= " | ";
}
}
return $str;
}
// 펑션 끝
기본 게시판에 삽입되어져 있는코드 ( list.skin.php )
<form name="fcategory" method="get" style="margin:0px;">
<? if ($is_category) { ?>
<select name=sca onchange="location='<?=$category_location?>'+this.value;">
<option value=''>전체</option>
<?=$category_option?>
</select>
<? } ?>
</form>
예제) 위내용을 지우시고 아래 내용을 추가해주세요
<?=get_category_list($bo_table);?>
댓글 6개
이러시면 될듯 :D