최신글 내용 길이 설정 하는법줌요 정보
최신글 내용 길이 설정 하는법줌요본문
제목과 내용 모두 최신글에서 출력 되게 되있는건데요
제목 길이는 설명 가능한데
내용 길이는 어떻게 줄이나요?
아래 소스 입니다.
<?
if (!defined("_GNUBOARD_")) exit; // e°œe³? ??i?´i§? ?‘e·¼ e¶?e?
$cols = 1; // ?´e?i§? e°?e¡œe°???// ?´e?i§? ?¸e¡œ e°?????eⓒ”i?¸??i?œ i§???i´??´e?i§? ??
$image_h = 1; // ?´e?i§? ??i?? e°?e²ⓒ
$col_width = (int)(99 / $cols);
$img_width = 94; //?¸e?¤??e°?e¡œe¸¸??
$img_height = 49; //?¸e?¤???¸e¡œe¸¸i?´
$img_quality = 100; //?¼e|¬??100?´i??e¡??¤i?? ?¼e? phpe²?i????i?œ??10?´i??????e¡œ i²?e|¬ ??????i?¼
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 ?´i?? e²?i?????¤i¹???i?´ ??i?´???¬i?ⓒ??????e?” e°¤e?¬e|?e²Œi?œ???…e????");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_img_list'; //?¸e?¤???´e?i§? ??i?± ?”e?‰??e|¬
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<style type="text/css">
<!--
.style1 {
font-size: 11px;
font-weight: bold;
}
.style2 { color:black;}
-->
</style>
<? for ($i=0; $i<count($list); $i++) { ?>
<?
$wr_content = "<a href='{$list[$i]['href']}'>".cut_str(strip_tags($list[$i]['wr_content']), 500, '...')."</a>";
// if ($i>0 && $i%$cols==0) { echo "<td colspan='$cols' height='$image_h'></td><tr>"; }
$img = "<img src='$g4_path/img/noimage.gif' border=1 width='$img_width' height='$img_height' title='?´e?i§? ?†i?Œ' align=left style='margin-right:5px; border:1 #222222 solid;'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// ?¬e?¤?¼e³¼ ??e¡œ ?¬e|°?Œi?¼ ??i§œe¥?e¹?eμ???i?¬ ??e?¤?¼i?? e°±i????e¸°??i?´??i§??´e?¤.
if ( file_exists($thumb) && (filemtime($thumb) < filemtime($list[$i][file][0][path] .'/'. $list[$i][file][0][file])) ) {
@unlink($thumb);
}
// ?¸e?¤???´e?i§?e°? i¡´i?¬??i? ??e?”?¤eⓒ´
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// ?…e¡œ?œe?œ ?Œi?¼???´e?i§??¼eⓒ´
//echo $i;
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
$width = (int)($size[0] * $rate);
// e³?i?°???¸e?¤???´e?i§????’i?´e°? ?¤i?????´e?i§????’i?´e³´e?¤ ?‘e?¤eⓒ?
$dst = imagecreatetruecolor($img_width, $img_height);
if ($height < $img_height) { // e³?i?°???´e?i§? ?’i?´e¡?e³μi?¬e³??´e?i§? ??i?±
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $img_height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
} else { // ?¤i?????´e?i§? ?’i?´e¡?e³μi?¬e³??´e?i§? ??i?±
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
}
//echo $i;
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' width=94 height=50 border=0>";
?>
<?
$datetime = substr($list[$i][wr_datetime],0,10);
$datetime2 = $list[$i][wr_datetime];
if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($row['bo_new'] * 3600))) $comment_new = "new";
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$a[$i] = array(
"wr_date"=>$datetime2,
);
?>
<?
$rw_subject = cut_str(stripslashes($list[$i][subject]),$subject_size,'..');
$a_link="<a href='{$list[$i][href]}'>$rw_subject</a>";
$a_img="<a href='{$list[$i][href]}'>$img</a>";
$a_comment="<a href=\"{$list[$i][comment_href]}\"><span class='commentFont'>{$list[$i]['comment_cnt']}</span></a>";
$rw_content = cut_str(stripslashes($list[$i][wr_content]),$content_size,' ..more');
$rw_content = strip_tags($rw_content);
?>
<table width="392" border="0" cellspacing="0" cellpadding="0" style="border-bottom-width:1; border-bottom-color:rgb(204,204,204); border-bottom-style:none;">
<tr>
<td align="center">
<div align="left">
<table width="95%" border="0" cellspacing="0" cellpadding="0" style="border-bottom-width:1; border-bottom-color:white; border-bottom-style:dashed;">
<tr>
<td width="70" height="58" valign="top" style="border-bottom-width:1; border-bottom-style:solid;"><div align="left">
<table width="25" border="0" cellspacing="1" bgcolor="white" style="border-width:1; border-color:rgb(204,204,204); border-style:solid;">
<tr>
<td width="19" height="10"><?=$a_img?></td>
</tr>
</table>
</div></td>
<td width="10"><div align="left"></div></td>
<td width="272" valign="top"><div align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="4"><?
echo "<a href='{$list[$i]['href']}' class=\"b\">";
echo "<font style='font-family:??; font-size:9pt; color:#f65f0c; font-weight:bold;';>{$list[$i]['subject']}";
echo "</a>";
?></td>
</tr>
<tr>
<td height="10">
<p class="style2"><font style='font-family:µ¸¿ò; font-size:9pt; color:#6A6A6A;'><?=$wr_content?></font>
</p></td>
</tr>
<tr>
<td></td>
</tr>
<!--
<tr>
<td class="gray8A">e¸??´i?´ : e§¤e|½?¸i?¬?´e“œ</td>
</tr>
-->
</table>
</div></td>
</tr>
</table>
</div></td>
</tr>
<td height="4"></td>
<td height="6" style="border-top-width:1; border-top-color:rgb(204,204,204); border-top-style:solid;"></td>
</table>
<?
}
?>
제목 길이는 설명 가능한데
내용 길이는 어떻게 줄이나요?
아래 소스 입니다.
<?
if (!defined("_GNUBOARD_")) exit; // e°œe³? ??i?´i§? ?‘e·¼ e¶?e?
$cols = 1; // ?´e?i§? e°?e¡œe°???// ?´e?i§? ?¸e¡œ e°?????eⓒ”i?¸??i?œ i§???i´??´e?i§? ??
$image_h = 1; // ?´e?i§? ??i?? e°?e²ⓒ
$col_width = (int)(99 / $cols);
$img_width = 94; //?¸e?¤??e°?e¡œe¸¸??
$img_height = 49; //?¸e?¤???¸e¡œe¸¸i?´
$img_quality = 100; //?¼e|¬??100?´i??e¡??¤i?? ?¼e? phpe²?i????i?œ??10?´i??????e¡œ i²?e|¬ ??????i?¼
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 ?´i?? e²?i?????¤i¹???i?´ ??i?´???¬i?ⓒ??????e?” e°¤e?¬e|?e²Œi?œ???…e????");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_img_list'; //?¸e?¤???´e?i§? ??i?± ?”e?‰??e|¬
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<style type="text/css">
<!--
.style1 {
font-size: 11px;
font-weight: bold;
}
.style2 { color:black;}
-->
</style>
<? for ($i=0; $i<count($list); $i++) { ?>
<?
$wr_content = "<a href='{$list[$i]['href']}'>".cut_str(strip_tags($list[$i]['wr_content']), 500, '...')."</a>";
// if ($i>0 && $i%$cols==0) { echo "<td colspan='$cols' height='$image_h'></td><tr>"; }
$img = "<img src='$g4_path/img/noimage.gif' border=1 width='$img_width' height='$img_height' title='?´e?i§? ?†i?Œ' align=left style='margin-right:5px; border:1 #222222 solid;'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// ?¬e?¤?¼e³¼ ??e¡œ ?¬e|°?Œi?¼ ??i§œe¥?e¹?eμ???i?¬ ??e?¤?¼i?? e°±i????e¸°??i?´??i§??´e?¤.
if ( file_exists($thumb) && (filemtime($thumb) < filemtime($list[$i][file][0][path] .'/'. $list[$i][file][0][file])) ) {
@unlink($thumb);
}
// ?¸e?¤???´e?i§?e°? i¡´i?¬??i? ??e?”?¤eⓒ´
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// ?…e¡œ?œe?œ ?Œi?¼???´e?i§??¼eⓒ´
//echo $i;
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
$width = (int)($size[0] * $rate);
// e³?i?°???¸e?¤???´e?i§????’i?´e°? ?¤i?????´e?i§????’i?´e³´e?¤ ?‘e?¤eⓒ?
$dst = imagecreatetruecolor($img_width, $img_height);
if ($height < $img_height) { // e³?i?°???´e?i§? ?’i?´e¡?e³μi?¬e³??´e?i§? ??i?±
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $img_height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
} else { // ?¤i?????´e?i§? ?’i?´e¡?e³μi?¬e³??´e?i§? ??i?±
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
}
//echo $i;
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' width=94 height=50 border=0>";
?>
<?
$datetime = substr($list[$i][wr_datetime],0,10);
$datetime2 = $list[$i][wr_datetime];
if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($row['bo_new'] * 3600))) $comment_new = "new";
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$a[$i] = array(
"wr_date"=>$datetime2,
);
?>
<?
$rw_subject = cut_str(stripslashes($list[$i][subject]),$subject_size,'..');
$a_link="<a href='{$list[$i][href]}'>$rw_subject</a>";
$a_img="<a href='{$list[$i][href]}'>$img</a>";
$a_comment="<a href=\"{$list[$i][comment_href]}\"><span class='commentFont'>{$list[$i]['comment_cnt']}</span></a>";
$rw_content = cut_str(stripslashes($list[$i][wr_content]),$content_size,' ..more');
$rw_content = strip_tags($rw_content);
?>
<table width="392" border="0" cellspacing="0" cellpadding="0" style="border-bottom-width:1; border-bottom-color:rgb(204,204,204); border-bottom-style:none;">
<tr>
<td align="center">
<div align="left">
<table width="95%" border="0" cellspacing="0" cellpadding="0" style="border-bottom-width:1; border-bottom-color:white; border-bottom-style:dashed;">
<tr>
<td width="70" height="58" valign="top" style="border-bottom-width:1; border-bottom-style:solid;"><div align="left">
<table width="25" border="0" cellspacing="1" bgcolor="white" style="border-width:1; border-color:rgb(204,204,204); border-style:solid;">
<tr>
<td width="19" height="10"><?=$a_img?></td>
</tr>
</table>
</div></td>
<td width="10"><div align="left"></div></td>
<td width="272" valign="top"><div align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="4"><?
echo "<a href='{$list[$i]['href']}' class=\"b\">";
echo "<font style='font-family:??; font-size:9pt; color:#f65f0c; font-weight:bold;';>{$list[$i]['subject']}";
echo "</a>";
?></td>
</tr>
<tr>
<td height="10">
<p class="style2"><font style='font-family:µ¸¿ò; font-size:9pt; color:#6A6A6A;'><?=$wr_content?></font>
</p></td>
</tr>
<tr>
<td></td>
</tr>
<!--
<tr>
<td class="gray8A">e¸??´i?´ : e§¤e|½?¸i?¬?´e“œ</td>
</tr>
-->
</table>
</div></td>
</tr>
</table>
</div></td>
</tr>
<td height="4"></td>
<td height="6" style="border-top-width:1; border-top-color:rgb(204,204,204); border-top-style:solid;"></td>
</table>
<?
}
?>
댓글 전체
$rw_content = cut_str(stripslashes($list[$i][wr_content]),$content_size,' ..more');
에서
$content_size 부분에 원하시는 글자수를 넣으세여...
250글자라면
$rw_content = cut_str(stripslashes($list[$i][wr_content]),250,' ..more');
이런식으로
대충봐서 되려나 모르겠네여...
에서
$content_size 부분에 원하시는 글자수를 넣으세여...
250글자라면
$rw_content = cut_str(stripslashes($list[$i][wr_content]),250,' ..more');
이런식으로
대충봐서 되려나 모르겠네여...
감사합니다^^