묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
리스트에서 제목이 긴경우 ...... 이렇게 표시되잖아요.. 이거 어떻게 바꾸어 주는거에요?
2003.06.01 14:23
list.php 부분인데 어느 부분을 수정해야 할까요? 초보자는..오늘도 웁니다.
<?
include "function.inc";
$connect=connect();
$query="SELECT count(*) FROM board";
$result=mysql_query($query,$connect);
$row=mysql_fetch_row($result);
$total=$row[0];
if(!$page)$page=1;
$ppage=$page-1;
$npage=$page+1;
$pgsize=15;
$totalpage=(int)($total/$pgsize);
if(($total%$pgsize)<>0)$totalpage++;
$rcount=1;
$cell_color=1;
style();
?>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<p align="center"> </p>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="625">
<tr>
<td width="625" colspan="7">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<form name=page>
<tr>
<td width="303">
<p><b><span style="font-size:9pt;">총 게시물 : <? echo $total ?></span></b></p>
</td>
<td width="303">
<p align="right"><b><span style="font-size:9pt;">현재 페이지 : <select name="page" onchange="location.replace('list.php?page='+document.page.page.value);">
<?
for($i=1;$i<=$totalpage;$i++)
{
if($i==$page) echo "<OPTION VALUE='$i' SELECTED>$i/$totalpage</OPTION>";
else echo "<OPTION VALUE='$i'>$i/$totalpage</OPTION>";
}
?>
</select></span></b></p>
</td>
</tr>
</form>
</table>
</td>
</tr>
<tr>
<td width="11">
<p><img src="img/bbs-01.gif" width="11" height="31" border="0"></p>
</td>
<td width="599" colspan="5">
<p><img src="img/bbs-02.gif" width="600" height="31" border="0"></p>
</td>
<td width="15">
<p><img src="img/bbs-03.gif" width="12" height="31" border="0"></p>
</td>
</tr>
<tr>
<td width="11" background="img/left-back.gif">
<p> </p>
</td>
<td width="46" bgcolor="E0F5E8">
<p align=center><b><span style="font-size:10pt;"><font color="151516">번호</font></span></b></p>
</td>
<td width="361" bgcolor="E0F5E8">
<p align=center><font color="151516"><span style="font-size:10pt;"><b>제목</b></span></font></p>
</td>
<td width="79" bgcolor="E0F5E8">
<p align=center><font color="151516"><span style="font-size:10pt;"><b>글쓴이</b></span></font></p>
</td>
<td width="47" bgcolor="E0F5E8">
<p align=center><font color="151516"><span style="font-size:10pt;"><b>조회수</b></span></font></p>
</td>
<td width="66" bgcolor="E0F5E8">
<p align=center><font color="151516"><span style="font-size:10pt;"><b>작성일</b></span></font></p>
</td>
<td width="15" background="img/right-back.gif">
<p> </p>
</td>
</tr>
<?
$query="SELECT id,num,email,subject,writer,visit,regtime,r_step FROM board ORDER BY num DESC,r_step ASC";
$result=mysql_query($query,$connect);
for($i=1;$i<=$pgsize*($page-1);$i++) $row=mysql_fetch_array($result);
while($row=mysql_fetch_array($result))
{
if(($cell_color%2)==0)$cell="#CCCCFF";
else $cell="#CCCCCC";
$cell_color++;
grammer_chk(2);
$regtime=substr($row[regtime],0,10);
?>
<tr bgcolor='<?echo $cell?>'>
<td width="11" background="img/left-back.gif">
<p> </p>
</td>
<td width="46">
<p align="center"><span style="font-size:9pt;"><?if($row[r_step]==0) echo $row[num]; else echo" ";?></span></p>
</td>
<td width="361">
<p><span style="font-size:9pt;"><?if($row[r_step]!=0){echo " <img src='img/re.gif'> ";} echo" <A href='read.php?id=$row[id]&r_step=$row[r_step]&page=$page'>$subject</A>";?></span></p>
</td>
<td width="79">
<p align="center"><span style="font-size:9pt;"><A href="mailto:<?echo $row[email]?>"><?echo $row[writer];?></a></span></p>
</td>
<td width="47">
<p align="center"><span style="font-size:9pt;"><?echo $row[visit];?></span></p>
</td>
<td width="66">
<p align="center"><span style="font-size:9pt;"><?echo $regtime;?></span></p>
</td>
<td width="15" background="img/right-back.gif">
<p> </p>
</td>
</tr>
<?
if($rcount==$pgsize)break;
else $rcount++;
}
?>
<tr>
<td width="11">
<p><img src="img/bbs-04.gif" width="11" height="19" border="0"></p>
</td>
<td width="599" background="img/down-back.gif" colspan="5">
<p> </p>
</td>
<td width="15">
<p><img src="img/bbs-05.gif" width="12" height="19" border="0"></p>
</td>
</tr>
</table>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="625">
<tr>
<td width="368" height="76">
<p align="center">
<?if($page>1) echo "<A href='list.php?page$ppage'><img src='img/previous.gif' width='44' height='44' border='0'></A>";
else echo"<img src='img/previous.gif' width='44' height='44' border='0'>";?>
<A href="write.php?page=<?echo $page?>"><img src="img/write.gif" width="45" height="44" border="0"></a>
<?if($page<$totalpage) echo"<A href='list.php?page=$npage'><img src='img/next.gif' width='43' height='44' border='0'></a>";
else echo "<img src='img/next.gif' width='43' height='44' border='0'>";?>
</p>
</td>
<form method="post" action="list.php">
<!------------- 게시물 검색을 위한 FORM -------------->
<input type=hidden name=subject value=<?echo $subject ?>>
<input type=hidden name=writer value='<?echo $writer ?>'>
<input type=hidden name=content value='<?echo $content ?>'>
<input type=hidden name=visit value='<?echo $visit ?>'>
<td width="257" height="76">
<p><img src="img/lens.gif" width="16" height="16">
<select name="type" size="1">
<option value="subject">제목</option>
<option value="writer">글쓴이</option>
<option value="content">내용</option>
<option value="visit">조회수</option>
</select> <input type="text" name="keyword" size="15"> <input type="submit" name="formbutton1" value="찾기"> </p>
</td>
</form>
</tr>
</table>
</body>
<?
mysql_close($connect);
?>
</html>
<?
include "function.inc";
$connect=connect();
$query="SELECT count(*) FROM board";
$result=mysql_query($query,$connect);
$row=mysql_fetch_row($result);
$total=$row[0];
if(!$page)$page=1;
$ppage=$page-1;
$npage=$page+1;
$pgsize=15;
$totalpage=(int)($total/$pgsize);
if(($total%$pgsize)<>0)$totalpage++;
$rcount=1;
$cell_color=1;
style();
?>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<p align="center"> </p>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="625">
<tr>
<td width="625" colspan="7">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<form name=page>
<tr>
<td width="303">
<p><b><span style="font-size:9pt;">총 게시물 : <? echo $total ?></span></b></p>
</td>
<td width="303">
<p align="right"><b><span style="font-size:9pt;">현재 페이지 : <select name="page" onchange="location.replace('list.php?page='+document.page.page.value);">
<?
for($i=1;$i<=$totalpage;$i++)
{
if($i==$page) echo "<OPTION VALUE='$i' SELECTED>$i/$totalpage</OPTION>";
else echo "<OPTION VALUE='$i'>$i/$totalpage</OPTION>";
}
?>
</select></span></b></p>
</td>
</tr>
</form>
</table>
</td>
</tr>
<tr>
<td width="11">
<p><img src="img/bbs-01.gif" width="11" height="31" border="0"></p>
</td>
<td width="599" colspan="5">
<p><img src="img/bbs-02.gif" width="600" height="31" border="0"></p>
</td>
<td width="15">
<p><img src="img/bbs-03.gif" width="12" height="31" border="0"></p>
</td>
</tr>
<tr>
<td width="11" background="img/left-back.gif">
<p> </p>
</td>
<td width="46" bgcolor="E0F5E8">
<p align=center><b><span style="font-size:10pt;"><font color="151516">번호</font></span></b></p>
</td>
<td width="361" bgcolor="E0F5E8">
<p align=center><font color="151516"><span style="font-size:10pt;"><b>제목</b></span></font></p>
</td>
<td width="79" bgcolor="E0F5E8">
<p align=center><font color="151516"><span style="font-size:10pt;"><b>글쓴이</b></span></font></p>
</td>
<td width="47" bgcolor="E0F5E8">
<p align=center><font color="151516"><span style="font-size:10pt;"><b>조회수</b></span></font></p>
</td>
<td width="66" bgcolor="E0F5E8">
<p align=center><font color="151516"><span style="font-size:10pt;"><b>작성일</b></span></font></p>
</td>
<td width="15" background="img/right-back.gif">
<p> </p>
</td>
</tr>
<?
$query="SELECT id,num,email,subject,writer,visit,regtime,r_step FROM board ORDER BY num DESC,r_step ASC";
$result=mysql_query($query,$connect);
for($i=1;$i<=$pgsize*($page-1);$i++) $row=mysql_fetch_array($result);
while($row=mysql_fetch_array($result))
{
if(($cell_color%2)==0)$cell="#CCCCFF";
else $cell="#CCCCCC";
$cell_color++;
grammer_chk(2);
$regtime=substr($row[regtime],0,10);
?>
<tr bgcolor='<?echo $cell?>'>
<td width="11" background="img/left-back.gif">
<p> </p>
</td>
<td width="46">
<p align="center"><span style="font-size:9pt;"><?if($row[r_step]==0) echo $row[num]; else echo" ";?></span></p>
</td>
<td width="361">
<p><span style="font-size:9pt;"><?if($row[r_step]!=0){echo " <img src='img/re.gif'> ";} echo" <A href='read.php?id=$row[id]&r_step=$row[r_step]&page=$page'>$subject</A>";?></span></p>
</td>
<td width="79">
<p align="center"><span style="font-size:9pt;"><A href="mailto:<?echo $row[email]?>"><?echo $row[writer];?></a></span></p>
</td>
<td width="47">
<p align="center"><span style="font-size:9pt;"><?echo $row[visit];?></span></p>
</td>
<td width="66">
<p align="center"><span style="font-size:9pt;"><?echo $regtime;?></span></p>
</td>
<td width="15" background="img/right-back.gif">
<p> </p>
</td>
</tr>
<?
if($rcount==$pgsize)break;
else $rcount++;
}
?>
<tr>
<td width="11">
<p><img src="img/bbs-04.gif" width="11" height="19" border="0"></p>
</td>
<td width="599" background="img/down-back.gif" colspan="5">
<p> </p>
</td>
<td width="15">
<p><img src="img/bbs-05.gif" width="12" height="19" border="0"></p>
</td>
</tr>
</table>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="625">
<tr>
<td width="368" height="76">
<p align="center">
<?if($page>1) echo "<A href='list.php?page$ppage'><img src='img/previous.gif' width='44' height='44' border='0'></A>";
else echo"<img src='img/previous.gif' width='44' height='44' border='0'>";?>
<A href="write.php?page=<?echo $page?>"><img src="img/write.gif" width="45" height="44" border="0"></a>
<?if($page<$totalpage) echo"<A href='list.php?page=$npage'><img src='img/next.gif' width='43' height='44' border='0'></a>";
else echo "<img src='img/next.gif' width='43' height='44' border='0'>";?>
</p>
</td>
<form method="post" action="list.php">
<!------------- 게시물 검색을 위한 FORM -------------->
<input type=hidden name=subject value=<?echo $subject ?>>
<input type=hidden name=writer value='<?echo $writer ?>'>
<input type=hidden name=content value='<?echo $content ?>'>
<input type=hidden name=visit value='<?echo $visit ?>'>
<td width="257" height="76">
<p><img src="img/lens.gif" width="16" height="16">
<select name="type" size="1">
<option value="subject">제목</option>
<option value="writer">글쓴이</option>
<option value="content">내용</option>
<option value="visit">조회수</option>
</select> <input type="text" name="keyword" size="15"> <input type="submit" name="formbutton1" value="찾기"> </p>
</td>
</form>
</tr>
</table>
</body>
<?
mysql_close($connect);
?>
</html>
암튼 맨위에 보니까 include되있더군요 fucntion.inc파일요..
그안에다가
제로보드에 포함된 함수를 넣어주세요
// 문자열 끊기 (이상의 길이일때는 ... 로 표시)
function cut_str($msg,$cut_size) {
if($cut_size<=0) return $msg;
if(ereg("\[re\]",$msg)) $cut_size=$cut_size+4;
for($i=0;$i<$cut_size;$i++) if(ord($msg[$i])>127) $han++; else $eng++;
$cut_size=$cut_size+(int)$han*0.6;
$point=1;
for ($i=0;$i<strlen($msg);$i++) {
if ($point>$cut_size) return $pointtmp."...";
if (ord($msg[$i])<=127) {
$pointtmp.= $msg[$i];
if ($point%$cut_size==0) return $pointtmp."...";
} else {
if ($point%$cut_size==0) return $pointtmp."...";
$pointtmp.=$msg[$i].$msg[++$i];
$point++;
}
$point++;
}
return $pointtmp;
}
그런다음 중간쯤에 리스트 뽑는부분.
$subject변수로 지정됬더군요..
그걸
echo cut_str($subject,글자수제한);
이렇게 해주시면 될듯합니다..