타이틀 글자수와 내용 글자수 좀 잘라주세요. 정보
타이틀 글자수와 내용 글자수 좀 잘라주세요.
본문
아래 소스에서 ".$row[title]." 글자수와 ".$row[content]." 의 글자수를 좀 잘라주세요..
<?
$main = get_blog_main($dv_id, $st, $sv, 15);
for($i=0; $i<sizeof($main); $i++)
{
$row = $main[$i];
// 첨부사진
$t_width=100;//섬네일 최대폭
$t_height=70;//섬네일 최대높이
$quality = 100;
$sql4 = " select * from {$gb4['file_table']} where blog_id = '$row[blog_id]' and post_id = '$row[id]' ";
$row4 = sql_fetch($sql4);
$thumb = $g4[path]."/data/blog/file/".$row[mb_id]."/".$row4[save_name]."_thumb";
if (!file_exists($thumb))
{
$file = $g4[path]."/data/blog/file/".$row[mb_id]."/".$row4[save_name];
//echo "<tr><td height=5>".$file ."</td></tr>";
// 업로드된 파일이 이미지라면
$size = @getimagesize($file);
if(is_array($size) && !is_file($thumb)) {
switch($size[2]) {
case(1) :
if(function_exists('ImageCreateFromGif')) $im = ImageCreateFromGif($file);
break;
case(2) :
if(function_exists('ImageCreateFromJpeg')) $im = ImageCreateFromJpeg($file);
break;
case(3) :
if(function_exists('ImageCreateFromPng')) $im = ImageCreateFromPng($file);
break;
}
$fixsize = mando_image_size($size[0], $size[1], $t_width, $t_height);
if($im) {
if($i==0) @exec("rm ".dirname($_SERVER[SCRIPT-x_FILENAME])."/data/blog/file/".$row[mb_id]."/".$row4[save_name]."_thumb-rf");
if(function_exists('ImageCreateTrueColor')) $newim = ImageCreateTrueColor($fixsize[x],$fixsize[y]);
else $newim = ImageCreate($fixsize[x],$fixsize[y]);
if(function_exists('ImageCopyResampled')) ImageCopyResampled($newim,$im,0,0,0,0,$fixsize[x],$fixsize[y],$size[0],$size[1]);
else ImageCopyResized($newim,$im,0,0,0,0,$fixsize[x],$fixsize[y],$size[0],$size[1]);
ImageDestroy($im);
ImageJpeg($newim, $thumb, 100);
ImageDestroy($newim);
unset($im, $newim);
}
$list[$i][img][x] = $fixsize[x];
$list[$i][img][y] = $fixsize[y];
} else {
if(is_file($thumb)) {
$size = @getimagesize($thumb);
$list[$i][img][x] = $size[0];
$list[$i][img][y] = $size[1];
} else {
$no_img = "$board_skin_path/img/no_img.jpg";
$size = @getimagesize($no_img);
$list[$i][img][x] = $size[0];
$list[$i][img][y] = $size[1];
}
}
if(is_file($thumb))$file = $thumb;
}
if (file_exists($thumb)){
$img = "<img src='$thumb' border=0 height='$t_height'>";
}
// echo "<tr><td height=5>".$img ."</td></tr>";
//echo "<tr><td height=5>".$row4[real_name] ."</td></tr>";
// 첨부사진 끝
if ($i>0) {
echo "<tr><td height=5 ></td></tr>";
echo "<tr><td height=1 bgcolor=#d2d2d2 ></td></tr>";
echo "<tr><td height=5 ></td></tr>";
}
echo "<tr><td height=25 >";
echo "<table width=100% cellpadding=0 cellspacing=0 align=center><tr><td width='70%' height=25 >";
echo "<span style='font-size:11pt;font-weight:bold;letter-spacing:-1px;'><a href='".get_post_url($row[id],$row[mb_id])."'>".$row[title]."</a></span>";
echo ":<span>".$row[writer]."</span> <span style='color:#999999''>님이 작성</span> ";
echo "<span style='color:#999999'' class='small'>(".$row[post_date].", ".$row[category_name].")</span></td></tr></table></td></tr>";
// 첨부사진
if($img){
if($row[id] == $row4[post_id]){
echo "<tr><td>";
echo "<table width=100% cellpadding=0 cellspacing=0 align=center><tr><td height=5 width=50 valign=top style='padding:3px;border:1px solid #777777'>".$img ."</td>";
echo "<td class=lh style='word-break:break-all;padding-left:5px;color:#999999'><div style='color:#999999''>".$row[content]."</div></td></tr></table>";
echo "</td></tr>";
// 첨부사진 끝
}else{
echo "<tr><td class=lh style='word-break:break-all;'><div style='color:#999999''>".$row[content]."</div>";
echo "</td></tr>";
}
}
}
위 소스에서 ".$row[title]." 글자수와 ".$row[content]." 의 글자수를 좀 잘라주세요..
초보 올림...
<?
$main = get_blog_main($dv_id, $st, $sv, 15);
for($i=0; $i<sizeof($main); $i++)
{
$row = $main[$i];
// 첨부사진
$t_width=100;//섬네일 최대폭
$t_height=70;//섬네일 최대높이
$quality = 100;
$sql4 = " select * from {$gb4['file_table']} where blog_id = '$row[blog_id]' and post_id = '$row[id]' ";
$row4 = sql_fetch($sql4);
$thumb = $g4[path]."/data/blog/file/".$row[mb_id]."/".$row4[save_name]."_thumb";
if (!file_exists($thumb))
{
$file = $g4[path]."/data/blog/file/".$row[mb_id]."/".$row4[save_name];
//echo "<tr><td height=5>".$file ."</td></tr>";
// 업로드된 파일이 이미지라면
$size = @getimagesize($file);
if(is_array($size) && !is_file($thumb)) {
switch($size[2]) {
case(1) :
if(function_exists('ImageCreateFromGif')) $im = ImageCreateFromGif($file);
break;
case(2) :
if(function_exists('ImageCreateFromJpeg')) $im = ImageCreateFromJpeg($file);
break;
case(3) :
if(function_exists('ImageCreateFromPng')) $im = ImageCreateFromPng($file);
break;
}
$fixsize = mando_image_size($size[0], $size[1], $t_width, $t_height);
if($im) {
if($i==0) @exec("rm ".dirname($_SERVER[SCRIPT-x_FILENAME])."/data/blog/file/".$row[mb_id]."/".$row4[save_name]."_thumb-rf");
if(function_exists('ImageCreateTrueColor')) $newim = ImageCreateTrueColor($fixsize[x],$fixsize[y]);
else $newim = ImageCreate($fixsize[x],$fixsize[y]);
if(function_exists('ImageCopyResampled')) ImageCopyResampled($newim,$im,0,0,0,0,$fixsize[x],$fixsize[y],$size[0],$size[1]);
else ImageCopyResized($newim,$im,0,0,0,0,$fixsize[x],$fixsize[y],$size[0],$size[1]);
ImageDestroy($im);
ImageJpeg($newim, $thumb, 100);
ImageDestroy($newim);
unset($im, $newim);
}
$list[$i][img][x] = $fixsize[x];
$list[$i][img][y] = $fixsize[y];
} else {
if(is_file($thumb)) {
$size = @getimagesize($thumb);
$list[$i][img][x] = $size[0];
$list[$i][img][y] = $size[1];
} else {
$no_img = "$board_skin_path/img/no_img.jpg";
$size = @getimagesize($no_img);
$list[$i][img][x] = $size[0];
$list[$i][img][y] = $size[1];
}
}
if(is_file($thumb))$file = $thumb;
}
if (file_exists($thumb)){
$img = "<img src='$thumb' border=0 height='$t_height'>";
}
// echo "<tr><td height=5>".$img ."</td></tr>";
//echo "<tr><td height=5>".$row4[real_name] ."</td></tr>";
// 첨부사진 끝
if ($i>0) {
echo "<tr><td height=5 ></td></tr>";
echo "<tr><td height=1 bgcolor=#d2d2d2 ></td></tr>";
echo "<tr><td height=5 ></td></tr>";
}
echo "<tr><td height=25 >";
echo "<table width=100% cellpadding=0 cellspacing=0 align=center><tr><td width='70%' height=25 >";
echo "<span style='font-size:11pt;font-weight:bold;letter-spacing:-1px;'><a href='".get_post_url($row[id],$row[mb_id])."'>".$row[title]."</a></span>";
echo ":<span>".$row[writer]."</span> <span style='color:#999999''>님이 작성</span> ";
echo "<span style='color:#999999'' class='small'>(".$row[post_date].", ".$row[category_name].")</span></td></tr></table></td></tr>";
// 첨부사진
if($img){
if($row[id] == $row4[post_id]){
echo "<tr><td>";
echo "<table width=100% cellpadding=0 cellspacing=0 align=center><tr><td height=5 width=50 valign=top style='padding:3px;border:1px solid #777777'>".$img ."</td>";
echo "<td class=lh style='word-break:break-all;padding-left:5px;color:#999999'><div style='color:#999999''>".$row[content]."</div></td></tr></table>";
echo "</td></tr>";
// 첨부사진 끝
}else{
echo "<tr><td class=lh style='word-break:break-all;'><div style='color:#999999''>".$row[content]."</div>";
echo "</td></tr>";
}
}
}
위 소스에서 ".$row[title]." 글자수와 ".$row[content]." 의 글자수를 좀 잘라주세요..
초보 올림...
댓글 전체
cut_str($row[title] ,보여줄글자수)
예) cut_str($row[title] ,30)
예) cut_str($row[title] ,30)