묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
윗글 질문의 게시판 프로그램의 list.php 소스입니다.
2003.05.26 18:09
<?
//함수 등록 부 ========================================================
function echo_line($no, $row)
{
// board와 비교해서 다른 부분 - 게시판 코드
Global $code, $hover_color, $line_color2;
// 게시번호
echo "<tr onMouseOver=this.style.backgroundColor='$hover_color' onMouseOut=this.style.backgroundColor=''>
<td align=center>$no</td>n";
// board와 비교해서 다른 부분 - 첨부파일 다운로드 링크
if(is_file("./upfile/$code/$row[main_no]/$row[dep_no]/$row[file]"))
{
//파일의 확장자 - (strrchr() 뒤에서 제일 처음 .이 나오는 곳까지의 문자열 구하는 함수)
$ext = strrchr($row[file],".");
switch($ext)
{
case ".mp3":
case ".mp2":
case ".wav":
$file_type = "audio.gif";
break;
case ".html_":
case ".htm_":
$file_type = "html.gif";
break;
case ".hwp":
$file_type = "hwp.gif";
break;
case ".doc":
$file_type = "msword.gif";
break;
case ".pdf":
$file_type = "pdf.gif";
break;
case ".txt":
$file_type = "txt.gif";
break;
case ".mpeg":
case ".mpg":
case ".asf":
$file_type = "video.gif";
break;
case ".gz":
case ".zip":
case ".rar":
$file_type = "zip.gif";
break;
case ".gif":
case ".jpg":
case ".png":
case ".bmp":
case ".jpeg":
$file_type = "image.gif";
break;
default :
$file_type = "unknown.gif";
}
$file_type = "<img src="./icon/$file_type" border=0>";
echo "<td align=center><a href="./upfile/$code/$row[main_no]/$row[dep_no]/$row[file]" target="_blank">$file_type</a></td>n";
}
else
echo "<td align=center> </td>n";
//위글과 아래글의 연관관계 고려하기....
$n = strpos($row[dep_no],"9");
if($n <= 0) $n = 4;
if($row[dep_no] == '9999') $n = 0;
$space = "";
if ($n != 0)
{
for($i=0;$i<$n;$i++)
//$space = $space." ";
$space= $space."Re : ";
}
if (strlen($row[title]) > 40) {
$cutnum = 40 - ($n * 2);
$title = substr($row[title], 0, $cutnum).".".".".".";
}
else
$title = $row[title];
// 게시물 제목과 읽기 링크
$title = $space.$title;
// new 아이콘 넣기
$today_date = date(Y)."-".date(m)."-".date(d);
$write_date = substr($row[date],0,10);
if($write_date == $today_date) {
if(strlen($new_img) > 0) {
$new_icon = "<img src='$new_img'>";
} else { $new_icon = "<img src='../board/icon/new3.gif' height=18>"; }
}
echo "<td align=left height=23><a href="JavaScript:view("."'$row[main_no]','$row[dep_no]')">$title</a> $new_icon</td>n";
//글쓴이 - 이메일이 있으면 이메일 링크를 한다.
if (strlen($row[email]) < 1)
echo "<td align=center>$row[name]</td>n";
else
echo "<td align=center><a href="mailto:$row[email]">$row[name]</a></td>n";
// 작성 날짜
echo "<td align=center>".substr($row[date],0,10)."</td>n";
// 조회수
echo "<td align=center>$row[view]</td></tr>n";
echo "<tr height=1 bgcolor=$line_color2><td colspan=6></td></tr>n";
}
// ========================================================함수 등록 부
//게시판 DB연결
include('./inc_board.html');
//게시물 목록 가져오기
if(strlen($keyword) > 0)
{
switch($keyword2)
{
case "name":
$sql="select * from board where code = '+ '+ '$code' and (name like '%$keyword%') order by date desc, main_no desc, dep_no desc";
break;
case "title":
$sql="select * from board where code = '$code' and (title like '%$keyword%') order by date desc, main_no desc, dep_no desc";
break;
case "content":
$sql="select * from board where code = '$code' and (content like '%$keyword%') order by date desc, main_no desc, dep_no desc";
break;
default :
$sql="select * from board where code = '$code' and (name like '%$keyword%' or title like '%$keyword%' or content like '%$keyword%') order by date desc, main_no desc, dep_no desc";
break;
}
}
else
{
$sql= "select * from board where code = '$code' order by date desc, main_no desc, dep_no desc";
}
$result = mysql_query($sql);
//한화면에 출력할 줄 수
$rows = $line_num;
// 전체글 목록 수
$count = mysql_num_rows($result);
// 현재 보여주는 페이지번호
if (empty($page)) $page = 1;
// 결과 중에서 현재 페이지의 첫번째 레코드셋으로 이동한다.
if ($start > 1) mysql_data_seek($result,$start);
// 총 페이지수
$total = ceil(($count)/$rows);
// 출력 페이지 링크 숫자 개수
// ◁ 10 11 12 13 14 15 16 ▷ <- 설정
$c_rows = $page_num;
?>
<html>
<head>
<title>한국산업인력공단 충청지역본부 방문을 환영합니다</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<link rel="stylesheet" href="../css/main.css" type="text/css">
<script language="JavaScript">
<!--
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
//-->
</script>
</head>
<body bgcolor="#ffFFFF" text="#444444" leftmargin="0" topmargin="0" link=000000 vlink=000000 alink=000000>
<table border="0" cellspacing="0" cellpadding="0" height="100%" width="799">
<tr>
<td width="163" background="../img/index/l_bg.gif">
<? include "../html/left.htm"; ?>
</td>
<td width="636" valign="top">
<table width="598" border="0" cellspacing="0" cellpadding="0" height="304" align="right">
<tr>
<td class=f3>
<!-- 시 작 -->
<? echo $head; ?>
<table width=<? echo "$main_table"; ?> border=0 cellspacing=0 cellpadding=0>
<tr>
<!---------------- 글 내용 보기를 위한 폼 --------------------->
<form name=view_form action="./view.php" method=get>
<input type=hidden name=code value='<?echo $code ?>'>
<input type=hidden name=page value='<?echo $page ?>'>
<input type=hidden name=start value='<?echo $start ?>'>
<input type=hidden name=main_no>
<input type=hidden name=dep_no>
<input type=hidden name=keyword value="<?echo $keyword ?>">
<input type=hidden name=keyword2 value="<?echo $keyword2 ?>">
</form>
<td align=center>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr><td align=center>
<?
if (strlen($title_img) > 0)
echo "<img src=$title_img border=0>";
else
echo "<font size=4><b>$board_title</b></font>";
?>
</td></tr>
</table><br>
<? echo $middle; ?>
<table cellspacing=0 border=0 width=90%>
<tr>
<td align=right><? echo "총 게시물 : $count, 페이지 : $page/$total" ?></td>
</tr>
</table>
<script language="JavaScript">
<!--
function view(main_no,dep_no) {
document.view_form.main_no.value = main_no;
document.view_form.dep_no.value = dep_no;
document.view_form.submit();
}
-->
</script>
<table cellspacing=0 border=0 width=90%>
<tr height=1 bgcolor=<? echo "$line_color"; ?>><td colspan=6></td></tr>
<tr bgcolor=<? echo"$main_color"; ?> height=25>
<td align=center width= 30>번호</td>
<td align=center width= 30>ⓒ</td>
<td align=center>제 목</td>
<td align=center width= 60>글쓴이</td>
<td align=center width= 80>날 짜</td>
<td align=center width= 40>조회</td>
</tr>
<tr height=1 bgcolor=<? echo "$line_color"; ?>><td colspan=7></td></tr>
<?
$line = 0;
while($row = mysql_fetch_array($result))
{
//번호
$no = $count-$start-$line;
//게시목록 출력
echo_line($no,$row);
//출력된 게시물의 수와 한화면에 보여줄 줄수와 비교
if(++$line==$rows) break;
}
// 게시물이 없는 경우
if ($count == 0)
echo "<tr bgcolor='#FFFFFF'><td colspan=6 align=center height=50>입력된 게시물이 없습니다.</td></tr>
<tr height=1 bgcolor=$line_color2><td colspan=6></td></tr>n";
?>
</table>
</td></tr>
<tr><td height=8></td></tr>
<tr><td align=center>
<table border=0 width=90% height=25>
<tr>
<!-- 홈 링크 -->
<?
if (strlen($home_img) == 0)
echo "<td align=center width=60 align=center bgcolor="$icon_color"><a href="$home_url" target="_top"><span>홈페이지</span></a></td>n";
else
echo "<td align=center width=60 align=center><a href="$home_url" target="_top"><img src=$home_img border=0></a></td>n";
?>
<!-- 전단계 링크 -->
<?
if (strlen($before_url) != 0) {
if (strlen($history_img) == 0)
echo "<td align=center width=60 align=center bgcolor="$icon_color"><a href="$before_url" target="_self"><span>전단계</span></a></td>n";
else
echo "<td align=center width=60 align=center><a href="$before_url" target="_self"><img src=$before_img border=0></a></td>n";
}
?>
<!-- 페이지 목록 -->
<td align=center valign=center>
<?
for($j=1 ; $j<=$total ; $j++)
{
if($j==1)
{
$list_link[$j]=0;
}
else
{
$list_link[$j]=$list_link[$j-1]+$rows;
}
}
// 시작될 링크 카운터
if(!$l_start || !$l_end)
{
$v_start=1;
if($total>$c_rows)
{
$v_end=$c_rows;
}
else
{
$v_end=$total;
}
$v_next_s=$v_start+$c_rows;
$v_next_e=$v_end+$c_rows;
if(!$smode)
{
for($m=$v_start;$m<=$v_end;$m++)
{
echo("<a href='./list.php?code=$code&keyword=$keyword&keyword2=$keyword2&start=$list_link[$m]&page=$m'>$m</a> ");
}
}
if($c_rows<$total)
{
echo("<a href='./list.php?code=$code&keyword=$keyword&keyword2=$keyword2&start=$list_link[$m]&page=$m&l_start=$v_next_s&l_end=$v_next_e'>▷</a> ");
}
}
// 페이지 번호
if($l_start || $l_end)
{
$v_start=$l_start;
$v_end=$l_end;
$p_start=($start-($rows*$c_rows));
$v_next_s=$v_start+$c_rows;
$v_next_e=$v_end+$c_rows;
if($v_next_s>=$total)
{
$v_next_s=$v_start+$c_rows;
$v_next_e=$v_end+$c_rows;
}
$v_prior_s=$v_start-$c_rows;
$v_prior_e=$v_end-$c_rows;
if($v_prior_s<=1)
{
$v_prior_s=$v_start-$c_rows;
$v_prior_e=$v_end-$c_rows;
}
if($v_start>1)
{
echo("<a href='./list.php?code=$code&keyword=$keyword&keyword2=$keyword2&start=$list_link[$v_prior_s]&page=$m&l_start=$v_prior_s&l_end=$v_prior_e'>◁</a> ");
}
for($m=$v_start;$m<=$v_end;$m++)
{
if($m<$total+1)
{
echo("<a href='./list.php?code=$code&keyword=$keyword&keyword2=$keyword2&start=$list_link[$m]&page=$m&l_start=$v_start&l_end=$v_end'>$m</a> ");
}
}
if($v_end<$total)
{
echo("<a href='./list.php?code=$code&keyword=$keyword&keyword2=$keyword2&start=$list_link[$v_next_s]&page=$m&l_start=$v_next_s&l_end=$v_next_e'>▷</a> ");
}
}
?>
</td>
<!-- 새글 작성 링크 -->
<?
$url = "code=$code&mode=new&page=$page";
if (strlen($write_img) == 0)
echo "<td align=center width=60 align=center bgcolor="$icon_color"><a href="./write.php?$url"><span>글쓰기</span></b></a></td>n";
else
echo "<td align=center width=60 align=center><a href="./write.php?$url"><img src=$write_img border=0></a></td>n";
?>
<!-- REROAD 링크 -->
<?
$url = "code=$code";
if (strlen($first_img) == 0)
echo "<td align=center width=60 align=center bgcolor="$icon_color"><a href="./list.php?$url"><span>GO FIRST</span></b></a></td>n";
else
echo "<td align=center width=60 align=center><a href="./list.php?$url"><img src=$first_img border=0></a></td>n";
?>
</tr>
<tr>
</tr>
</table>
<table cellspacing=0 border=0 width=90%>
<tr>
<td align=center colspan=2>
<!------------- 게시물 검색을 위한 FORM -------------->
<form name=search_form action="./list.php" method=get>
<input type=hidden name=code value=<?echo $code ?>>
<input type=hidden name=page value='<?echo $page ?>'>
<input type=hidden name=start value='<?echo $start ?>'>
<select name=keyword2 style="BORDER-RIGHT: <? echo "$line_color2"; ?> 1px solid; BORDER-TOP: <? echo "$line_color2"; ?> 1px solid; BORDER-LEFT: <? echo "$line_color2"; ?> 1px solid; BORDER-BOTTOM: <? echo "$line_color2"; ?> 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <? echo "$form_color"; ?>">
<option value=name>글쓴이</option>
<option value=title>제목</option>
<option value=content>내용</option>
<option value=any selected>전체</option>
</select>
<!-- 검색을 선택하도록 하는 자바스크립트 -->
<script language="JavaScript">
<?
switch ($keyword2)
{
case "name":
echo "document.search_form.keyword2[0].selected= true;";
break;
case "title":
echo "document.search_form.keyword2[1].selected= true;";
break;
case "content":
echo "document.search_form.keyword2[2].selected= true;";
break;
default :
echo "document.search_form.keyword2[3].selected= true;";
break;
}
?>
</script>
<input type=text name=keyword size=15 value="<? echo $keyword ?>" style="BORDER-RIGHT: <? echo "$line_color2"; ?> 1px solid; BORDER-TOP: <? echo "$line_color2"; ?> 1px solid; BORDER-LEFT: <? echo "$line_color2"; ?> 1px solid; BORDER-BOTTOM: <? echo "$line_color2"; ?> 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <? echo "$form_color"; ?>">
<input type=button value="검색" onClick="document.search_form.submit()">
</form>
</td>
</tr>
</table>
</td></tr></table>
<? echo"$tail"; ?>
<!-- 끝 -->
</td>
</tr>
<tr>
<td height="35" valign="bottom">
<div align="center"><font color="595959">Copyright @2002 All right
reserved Human Resources Development Service of Korea</font></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
//함수 등록 부 ========================================================
function echo_line($no, $row)
{
// board와 비교해서 다른 부분 - 게시판 코드
Global $code, $hover_color, $line_color2;
// 게시번호
echo "<tr onMouseOver=this.style.backgroundColor='$hover_color' onMouseOut=this.style.backgroundColor=''>
<td align=center>$no</td>n";
// board와 비교해서 다른 부분 - 첨부파일 다운로드 링크
if(is_file("./upfile/$code/$row[main_no]/$row[dep_no]/$row[file]"))
{
//파일의 확장자 - (strrchr() 뒤에서 제일 처음 .이 나오는 곳까지의 문자열 구하는 함수)
$ext = strrchr($row[file],".");
switch($ext)
{
case ".mp3":
case ".mp2":
case ".wav":
$file_type = "audio.gif";
break;
case ".html_":
case ".htm_":
$file_type = "html.gif";
break;
case ".hwp":
$file_type = "hwp.gif";
break;
case ".doc":
$file_type = "msword.gif";
break;
case ".pdf":
$file_type = "pdf.gif";
break;
case ".txt":
$file_type = "txt.gif";
break;
case ".mpeg":
case ".mpg":
case ".asf":
$file_type = "video.gif";
break;
case ".gz":
case ".zip":
case ".rar":
$file_type = "zip.gif";
break;
case ".gif":
case ".jpg":
case ".png":
case ".bmp":
case ".jpeg":
$file_type = "image.gif";
break;
default :
$file_type = "unknown.gif";
}
$file_type = "<img src="./icon/$file_type" border=0>";
echo "<td align=center><a href="./upfile/$code/$row[main_no]/$row[dep_no]/$row[file]" target="_blank">$file_type</a></td>n";
}
else
echo "<td align=center> </td>n";
//위글과 아래글의 연관관계 고려하기....
$n = strpos($row[dep_no],"9");
if($n <= 0) $n = 4;
if($row[dep_no] == '9999') $n = 0;
$space = "";
if ($n != 0)
{
for($i=0;$i<$n;$i++)
//$space = $space." ";
$space= $space."Re : ";
}
if (strlen($row[title]) > 40) {
$cutnum = 40 - ($n * 2);
$title = substr($row[title], 0, $cutnum).".".".".".";
}
else
$title = $row[title];
// 게시물 제목과 읽기 링크
$title = $space.$title;
// new 아이콘 넣기
$today_date = date(Y)."-".date(m)."-".date(d);
$write_date = substr($row[date],0,10);
if($write_date == $today_date) {
if(strlen($new_img) > 0) {
$new_icon = "<img src='$new_img'>";
} else { $new_icon = "<img src='../board/icon/new3.gif' height=18>"; }
}
echo "<td align=left height=23><a href="JavaScript:view("."'$row[main_no]','$row[dep_no]')">$title</a> $new_icon</td>n";
//글쓴이 - 이메일이 있으면 이메일 링크를 한다.
if (strlen($row[email]) < 1)
echo "<td align=center>$row[name]</td>n";
else
echo "<td align=center><a href="mailto:$row[email]">$row[name]</a></td>n";
// 작성 날짜
echo "<td align=center>".substr($row[date],0,10)."</td>n";
// 조회수
echo "<td align=center>$row[view]</td></tr>n";
echo "<tr height=1 bgcolor=$line_color2><td colspan=6></td></tr>n";
}
// ========================================================함수 등록 부
//게시판 DB연결
include('./inc_board.html');
//게시물 목록 가져오기
if(strlen($keyword) > 0)
{
switch($keyword2)
{
case "name":
$sql="select * from board where code = '+ '+ '$code' and (name like '%$keyword%') order by date desc, main_no desc, dep_no desc";
break;
case "title":
$sql="select * from board where code = '$code' and (title like '%$keyword%') order by date desc, main_no desc, dep_no desc";
break;
case "content":
$sql="select * from board where code = '$code' and (content like '%$keyword%') order by date desc, main_no desc, dep_no desc";
break;
default :
$sql="select * from board where code = '$code' and (name like '%$keyword%' or title like '%$keyword%' or content like '%$keyword%') order by date desc, main_no desc, dep_no desc";
break;
}
}
else
{
$sql= "select * from board where code = '$code' order by date desc, main_no desc, dep_no desc";
}
$result = mysql_query($sql);
//한화면에 출력할 줄 수
$rows = $line_num;
// 전체글 목록 수
$count = mysql_num_rows($result);
// 현재 보여주는 페이지번호
if (empty($page)) $page = 1;
// 결과 중에서 현재 페이지의 첫번째 레코드셋으로 이동한다.
if ($start > 1) mysql_data_seek($result,$start);
// 총 페이지수
$total = ceil(($count)/$rows);
// 출력 페이지 링크 숫자 개수
// ◁ 10 11 12 13 14 15 16 ▷ <- 설정
$c_rows = $page_num;
?>
<html>
<head>
<title>한국산업인력공단 충청지역본부 방문을 환영합니다</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<link rel="stylesheet" href="../css/main.css" type="text/css">
<script language="JavaScript">
<!--
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
//-->
</script>
</head>
<body bgcolor="#ffFFFF" text="#444444" leftmargin="0" topmargin="0" link=000000 vlink=000000 alink=000000>
<table border="0" cellspacing="0" cellpadding="0" height="100%" width="799">
<tr>
<td width="163" background="../img/index/l_bg.gif">
<? include "../html/left.htm"; ?>
</td>
<td width="636" valign="top">
<table width="598" border="0" cellspacing="0" cellpadding="0" height="304" align="right">
<tr>
<td class=f3>
<!-- 시 작 -->
<? echo $head; ?>
<table width=<? echo "$main_table"; ?> border=0 cellspacing=0 cellpadding=0>
<tr>
<!---------------- 글 내용 보기를 위한 폼 --------------------->
<form name=view_form action="./view.php" method=get>
<input type=hidden name=code value='<?echo $code ?>'>
<input type=hidden name=page value='<?echo $page ?>'>
<input type=hidden name=start value='<?echo $start ?>'>
<input type=hidden name=main_no>
<input type=hidden name=dep_no>
<input type=hidden name=keyword value="<?echo $keyword ?>">
<input type=hidden name=keyword2 value="<?echo $keyword2 ?>">
</form>
<td align=center>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr><td align=center>
<?
if (strlen($title_img) > 0)
echo "<img src=$title_img border=0>";
else
echo "<font size=4><b>$board_title</b></font>";
?>
</td></tr>
</table><br>
<? echo $middle; ?>
<table cellspacing=0 border=0 width=90%>
<tr>
<td align=right><? echo "총 게시물 : $count, 페이지 : $page/$total" ?></td>
</tr>
</table>
<script language="JavaScript">
<!--
function view(main_no,dep_no) {
document.view_form.main_no.value = main_no;
document.view_form.dep_no.value = dep_no;
document.view_form.submit();
}
-->
</script>
<table cellspacing=0 border=0 width=90%>
<tr height=1 bgcolor=<? echo "$line_color"; ?>><td colspan=6></td></tr>
<tr bgcolor=<? echo"$main_color"; ?> height=25>
<td align=center width= 30>번호</td>
<td align=center width= 30>ⓒ</td>
<td align=center>제 목</td>
<td align=center width= 60>글쓴이</td>
<td align=center width= 80>날 짜</td>
<td align=center width= 40>조회</td>
</tr>
<tr height=1 bgcolor=<? echo "$line_color"; ?>><td colspan=7></td></tr>
<?
$line = 0;
while($row = mysql_fetch_array($result))
{
//번호
$no = $count-$start-$line;
//게시목록 출력
echo_line($no,$row);
//출력된 게시물의 수와 한화면에 보여줄 줄수와 비교
if(++$line==$rows) break;
}
// 게시물이 없는 경우
if ($count == 0)
echo "<tr bgcolor='#FFFFFF'><td colspan=6 align=center height=50>입력된 게시물이 없습니다.</td></tr>
<tr height=1 bgcolor=$line_color2><td colspan=6></td></tr>n";
?>
</table>
</td></tr>
<tr><td height=8></td></tr>
<tr><td align=center>
<table border=0 width=90% height=25>
<tr>
<!-- 홈 링크 -->
<?
if (strlen($home_img) == 0)
echo "<td align=center width=60 align=center bgcolor="$icon_color"><a href="$home_url" target="_top"><span>홈페이지</span></a></td>n";
else
echo "<td align=center width=60 align=center><a href="$home_url" target="_top"><img src=$home_img border=0></a></td>n";
?>
<!-- 전단계 링크 -->
<?
if (strlen($before_url) != 0) {
if (strlen($history_img) == 0)
echo "<td align=center width=60 align=center bgcolor="$icon_color"><a href="$before_url" target="_self"><span>전단계</span></a></td>n";
else
echo "<td align=center width=60 align=center><a href="$before_url" target="_self"><img src=$before_img border=0></a></td>n";
}
?>
<!-- 페이지 목록 -->
<td align=center valign=center>
<?
for($j=1 ; $j<=$total ; $j++)
{
if($j==1)
{
$list_link[$j]=0;
}
else
{
$list_link[$j]=$list_link[$j-1]+$rows;
}
}
// 시작될 링크 카운터
if(!$l_start || !$l_end)
{
$v_start=1;
if($total>$c_rows)
{
$v_end=$c_rows;
}
else
{
$v_end=$total;
}
$v_next_s=$v_start+$c_rows;
$v_next_e=$v_end+$c_rows;
if(!$smode)
{
for($m=$v_start;$m<=$v_end;$m++)
{
echo("<a href='./list.php?code=$code&keyword=$keyword&keyword2=$keyword2&start=$list_link[$m]&page=$m'>$m</a> ");
}
}
if($c_rows<$total)
{
echo("<a href='./list.php?code=$code&keyword=$keyword&keyword2=$keyword2&start=$list_link[$m]&page=$m&l_start=$v_next_s&l_end=$v_next_e'>▷</a> ");
}
}
// 페이지 번호
if($l_start || $l_end)
{
$v_start=$l_start;
$v_end=$l_end;
$p_start=($start-($rows*$c_rows));
$v_next_s=$v_start+$c_rows;
$v_next_e=$v_end+$c_rows;
if($v_next_s>=$total)
{
$v_next_s=$v_start+$c_rows;
$v_next_e=$v_end+$c_rows;
}
$v_prior_s=$v_start-$c_rows;
$v_prior_e=$v_end-$c_rows;
if($v_prior_s<=1)
{
$v_prior_s=$v_start-$c_rows;
$v_prior_e=$v_end-$c_rows;
}
if($v_start>1)
{
echo("<a href='./list.php?code=$code&keyword=$keyword&keyword2=$keyword2&start=$list_link[$v_prior_s]&page=$m&l_start=$v_prior_s&l_end=$v_prior_e'>◁</a> ");
}
for($m=$v_start;$m<=$v_end;$m++)
{
if($m<$total+1)
{
echo("<a href='./list.php?code=$code&keyword=$keyword&keyword2=$keyword2&start=$list_link[$m]&page=$m&l_start=$v_start&l_end=$v_end'>$m</a> ");
}
}
if($v_end<$total)
{
echo("<a href='./list.php?code=$code&keyword=$keyword&keyword2=$keyword2&start=$list_link[$v_next_s]&page=$m&l_start=$v_next_s&l_end=$v_next_e'>▷</a> ");
}
}
?>
</td>
<!-- 새글 작성 링크 -->
<?
$url = "code=$code&mode=new&page=$page";
if (strlen($write_img) == 0)
echo "<td align=center width=60 align=center bgcolor="$icon_color"><a href="./write.php?$url"><span>글쓰기</span></b></a></td>n";
else
echo "<td align=center width=60 align=center><a href="./write.php?$url"><img src=$write_img border=0></a></td>n";
?>
<!-- REROAD 링크 -->
<?
$url = "code=$code";
if (strlen($first_img) == 0)
echo "<td align=center width=60 align=center bgcolor="$icon_color"><a href="./list.php?$url"><span>GO FIRST</span></b></a></td>n";
else
echo "<td align=center width=60 align=center><a href="./list.php?$url"><img src=$first_img border=0></a></td>n";
?>
</tr>
<tr>
</tr>
</table>
<table cellspacing=0 border=0 width=90%>
<tr>
<td align=center colspan=2>
<!------------- 게시물 검색을 위한 FORM -------------->
<form name=search_form action="./list.php" method=get>
<input type=hidden name=code value=<?echo $code ?>>
<input type=hidden name=page value='<?echo $page ?>'>
<input type=hidden name=start value='<?echo $start ?>'>
<select name=keyword2 style="BORDER-RIGHT: <? echo "$line_color2"; ?> 1px solid; BORDER-TOP: <? echo "$line_color2"; ?> 1px solid; BORDER-LEFT: <? echo "$line_color2"; ?> 1px solid; BORDER-BOTTOM: <? echo "$line_color2"; ?> 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <? echo "$form_color"; ?>">
<option value=name>글쓴이</option>
<option value=title>제목</option>
<option value=content>내용</option>
<option value=any selected>전체</option>
</select>
<!-- 검색을 선택하도록 하는 자바스크립트 -->
<script language="JavaScript">
<?
switch ($keyword2)
{
case "name":
echo "document.search_form.keyword2[0].selected= true;";
break;
case "title":
echo "document.search_form.keyword2[1].selected= true;";
break;
case "content":
echo "document.search_form.keyword2[2].selected= true;";
break;
default :
echo "document.search_form.keyword2[3].selected= true;";
break;
}
?>
</script>
<input type=text name=keyword size=15 value="<? echo $keyword ?>" style="BORDER-RIGHT: <? echo "$line_color2"; ?> 1px solid; BORDER-TOP: <? echo "$line_color2"; ?> 1px solid; BORDER-LEFT: <? echo "$line_color2"; ?> 1px solid; BORDER-BOTTOM: <? echo "$line_color2"; ?> 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <? echo "$form_color"; ?>">
<input type=button value="검색" onClick="document.search_form.submit()">
</form>
</td>
</tr>
</table>
</td></tr></table>
<? echo"$tail"; ?>
<!-- 끝 -->
</td>
</tr>
<tr>
<td height="35" valign="bottom">
<div align="center"><font color="595959">Copyright @2002 All right
reserved Human Resources Development Service of Korea</font></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>