//µ¥ÀÌÅÍ º£À̽º ¿¬°áÇϱâ
include "../common/config.php";
include "../common/util.php";
$board = "notice";
if($search != "")
{
if($select == 1)
{
$search = " where commend like '%$search%' ";
}
else if($select == 2)
{
$search = " where title like '%$search%' ";
}
else if($select == 3)
{
$search = " where name like '%$search%' ";
}
}
#########################################################################
# LIST ¼³Á¤
# 1. ÇÑ ÆäÀÌÁö¿¡ º¸¿©Áú °Ô½Ã¹°ÀÇ ¼ö
$page_size=10;
# 2. ÆäÀÌÁö ³ª´©±â¿¡ Ç¥½ÃµÉ ÆäÀÌÁöÀÇ ¼ö
$page_list_size = 10;
#########################################################################
if (!$no || $no < 0) $no=0; //$no °ªÀÌ ¾È³Ñ¾î ¿À°Å³ª À߸øµÈ(À½¼ö)°ªÀÌ ³Ñ¾î¿À´Â °æ¿ì 0À¸·Î ó¸®
#########################################################################
// µ¥ÀÌÅͺ£À̽º¿¡¼ ÆäÀÌÁöÀÇ Ã¹¹ø° ±Û($no)ºÎÅÍ $page_size ¸¸ÅÀÇ ±ÛÀ» °¡Á®¿Â´Ù.
$query = "select * from $board $search order by thread desc limit $no,$page_size";
$result = mysql_query($query, $conn);
// ÃÑ °Ô½Ã¹° ¼ö ¸¦ ±¸ÇÑ´Ù.
//count ¸¦ ÅëÇØ ±¸ÇÒ ¼ö Àִµ¥ count(Ç׸ñ) °ú °°Àº ¹æ¹ýÀ¸·Î »ç¿ëÇÑ´Ù. * ´Â ¸ðµç Ç׸ñÀ» ¶æÇÑ´Ù.
//ÃÑ ÇØ´ç Ç׸ñÀÇ °ªÀ» °¡Áö´Â °Ô½Ã¹°ÀÇ °³¼ö°¡ ¾ó¸¶Àΰ¡¸¦ ¹¯´Â°ÍÀÌ´Ù.
//µû¶ó¼ Àüü ±Û¼ö°¡ µÈ´Ù. count(id) ¿Í °°Àº ¹æ¹ýµµ °¡´ÉÇÏÁö¸¸ ÀÌ·ÊÀûÀ¸·Î count(*)°¡ Á¶±Ý ºü¸£´Ù. ÀϹÝÀûÀ¸·Î´Â * °¡ ´À¸®´Ù.
$result_count=mysql_query("select count(*) from $board $search",$conn);
$result_row=mysql_fetch_row($result_count);
$total_row = $result_row[0];
//°á°úÀÇ Ã¹¹ø° ¿ÀÌ count(*) ÀÇ °á°ú´Ù.
#########################################################################
# ÃÑ ÆäÀÌÁö °è»ê
if ($total_row <= 0) $total_row = 0; // ÃѰԽù°ÀÇ °ªÀÌ ¾ø°Å³ª ÇÒ°æ¿ì ±âº»°ªÀ¸·Î ¼¼ÆÃ
// ÃѰԽù°¿¡ 1À» »«µÚ ÆäÀÌÁö »çÀÌÁî·Î ³ª´©°í ¼Ò¼öÁ¡ÀÌÇϸ¦ ¹ö¸°´Ù.
$total_page = floor(($total_row - 1) / $page_size); #2003/11/2 (bug report by guy209)
#
# ÇöÀç ÆäÀÌÁö °è»ê
$current_page = floor($no/$page_size);
# $no À» ÅëÇؼ ÆäÀÌÁöÀÇ Ã¹¹ø° ±ÛÀÌ ¸î¹ø° ±ÛÀÎÁö Àü´ÞµÈ´Ù.
# µû¶ó¼ ÆäÀÌÁö »çÀÌÁî·Î ³ª´©¸é ÇöÀç°¡ ¸î¹ø° ÆäÀÌÁöÀÎÁö ¾Ë¼öÀÖ´Ù.
# $no ÀÌ 10ÀÌ°í ÆäÀÌÁö»çÀÌÁî°¡ 10 À̶ó¸é °á°ú´Â 1ÀÌ´Ù. ¾Õ¼ ÆäÀÌÁö´Â 0ºÎÅÍ ½ÃÀÛÀ̶ó°í ÇßÀ¸´Ï µÎ¹ø° ÆäÀÌÁöÀÓÀ» ³ªÅ¸³½´Ù.
# ±×·¸´Ù¸é $no ÀÌ 11À̶ó¸é 1.1 ÀÌ µÇ¾î¹ö¸°´Ù. 11¹ø° ±Ûµµ µÎ¹ø° ÆäÀÌÁö¿¡ Á¸ÀçÇϹǷΠ0.1Àº ¹«ÀǹÌÇÏ´Ï ¹ö¸°´Ù.
# ±×·±µ¥ $no À̶õ °ªÀÌ $page_size ¸¸Å¾¿ Áõ°¡µÇ´Â °ªÀ̱⶧¹®¿¡ (0,10,20,30 °ú °°Àº µîÂ÷¼ö¿) ³»¸²À» ÇÏ´Â°Í ¶ÇÇÑ ¹«ÀǹÌÇÏ´Ù.
# ±×·¯³ª ³»¸²À» ÇÏ´Â ÀÌÀ¯´Â $no °ª¿¡ 11°ú °°Àº °ªÀÌ µé¾î¿Íµµ Á¦´ë·Î Ãâ·ÂµÇ±â¸¦ ¹Ù¶ó´Â ¸¶À½¿¡¼ ÇسõÀº°ÍÀÌ´Ù.
?>
ûdz±è¾¾
include '../include/top.html'; ?>
|
include '../include/left_img.html'; ?>
|
|
if($total_row != 0)
{
while($row=mysql_fetch_array($result))
{
if(strlen($row[title]) > 45)
{
$text = substr($row[title],0,45);
$text .= "...";
}
else
{
$text = $row[title];
}
?>
=$row[id]?> |
|
if ($row[depth] > 0) echo "¡æ"?>&no==$no?>>=strip_tags($text, '');?> |
=$row[name]?> |
=date("Y-m-d",$row[wdate])?> |
=$row[see]?> |
|
} // end While
}
else
{
?>
µî·ÏµÈ ±ÛÀÌ ¾ø½À´Ï´Ù. |
|
}
//µ¥ÀÌÅͺ£À̽º¿ÍÀÇ ¿¬°áÀ» ³¡´Â´Ù.
mysql_close($conn);
?>
|
include '../include/bottom.html'; ?>