최신글 출력 글 수를 제한 하고 싶습니다. 정보
최신글 출력 글 수를 제한 하고 싶습니다.본문
다음은 최신글 소스입니다.
이미지 출력과 함께 제목, 이름, 내용이 출력되게 되어 있습니다.
그런데 내용 출력 부분에서 글자 수 제한이 없기때문에
예를 들면 본문 내용의 30자까지만 추력을 하고 싶습니다.
어느 부분을 수정하면 될는지 알려주시며 감사하겠습니다.
수고하세요.
===========================================================
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 시작 -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="7"></td><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="7"></td><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<? for ($i=0; $i<count($list); $i++) {
$image = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);
if (!file_exists($image) || !$list[$i][file][0][file])
$image = "$latest_skin_path/img/no_image.gif";
?>
if (!file_exists($image) || !$list[$i][file][0][file])
$image = "$latest_skin_path/img/no_image.gif";
?>
<tr>
<td width="70">
<table width="70" height="70" border="0" background="<?=$latest_skin_path?>/img/ws_imgbg.gif">
<tr>
<td align="center"><a href="<?=$list[$i][href]?>"><img src="<?=$image?>" width='140' height='120' border='0'></a></td>
</tr>
</table>
<table height="2">
<tr>
<td></td>
</tr>
</table>
</tr>
<td width="3"></td>
<td valign="top">
<table>
<tr>
<td>
<?
echo $list[$i][icon_reply] . " ";
echo "<a href='{$list[$i][href]}'>";
if ($list[$i][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#696969;'><strong>{$list[$i][subject]}</strong></font>";
elseif ($i=='0')
echo "<img src='$latest_skin_path/img/latest_icon01.gif' border='0'> <font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'><strong>{$list[$i][subject]}</strong></font>";
else
echo "<img src='$latest_skin_path/img/latest_icon01.gif' border='0'> <font style='font-family:돋움; font-size:9pt; color:#696969;'><b>{$list[$i][subject]}</b></font>";
echo "</a>";
?>
</td>
</tr>
<tr>
<td height="1" bgcolor="f9f9f9" colspan="3"></td>
</tr>
<tr>
<td>
<?
echo "<img src='$latest_skin_path/img/latest_icon02.gif' border='0'> <font style='font-family:돋움; font-size:8pt; color:#696969;'>등록자 : {$list[$i][mb_id]}</font>";
echo "</a>";
?>
</td>
</tr>
<tr>
<td height="1" bgcolor="f9f9f9" colspan="3"></td>
</tr>
<tr>
<td>
<?
echo "<img src='$latest_skin_path/img/latest_icon03.gif' border='0'> <font style='font-family:돋움; font-size:8pt; color:#696969;'>{$list[$i][wr_content]}</font>";
echo "</a>";
?>
</td>
</tr>
</table>
<? } ?>
</td>
</tr>
<td width="70">
<table width="70" height="70" border="0" background="<?=$latest_skin_path?>/img/ws_imgbg.gif">
<tr>
<td align="center"><a href="<?=$list[$i][href]?>"><img src="<?=$image?>" width='140' height='120' border='0'></a></td>
</tr>
</table>
<table height="2">
<tr>
<td></td>
</tr>
</table>
</tr>
<td width="3"></td>
<td valign="top">
<table>
<tr>
<td>
<?
echo $list[$i][icon_reply] . " ";
echo "<a href='{$list[$i][href]}'>";
if ($list[$i][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#696969;'><strong>{$list[$i][subject]}</strong></font>";
elseif ($i=='0')
echo "<img src='$latest_skin_path/img/latest_icon01.gif' border='0'> <font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'><strong>{$list[$i][subject]}</strong></font>";
else
echo "<img src='$latest_skin_path/img/latest_icon01.gif' border='0'> <font style='font-family:돋움; font-size:9pt; color:#696969;'><b>{$list[$i][subject]}</b></font>";
echo "</a>";
?>
</td>
</tr>
<tr>
<td height="1" bgcolor="f9f9f9" colspan="3"></td>
</tr>
<tr>
<td>
<?
echo "<img src='$latest_skin_path/img/latest_icon02.gif' border='0'> <font style='font-family:돋움; font-size:8pt; color:#696969;'>등록자 : {$list[$i][mb_id]}</font>";
echo "</a>";
?>
</td>
</tr>
<tr>
<td height="1" bgcolor="f9f9f9" colspan="3"></td>
</tr>
<tr>
<td>
<?
echo "<img src='$latest_skin_path/img/latest_icon03.gif' border='0'> <font style='font-family:돋움; font-size:8pt; color:#696969;'>{$list[$i][wr_content]}</font>";
echo "</a>";
?>
</td>
</tr>
</table>
<? } ?>
</td>
</tr>
<? if (count($list) == 0) { ?>
<tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
<? } ?>
</table>
</td></tr></table>
<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 끝 -->
<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 끝 -->
댓글 전체
> {$list[$i][wr_content]}
{cut_str(get_text($list[$i][wr_content],30)}
{cut_str(get_text($list[$i][wr_content],30)}
루트님.
{$list[$i][wr_content]} 를 {cut_str(get_text($list[$i][wr_content],30)}로
바꾸라는 말씀이시죠? 바꾸면 출력인 아래와 같이..
{cut_str(get_text(Array[wr_content],30)}
그리고 답변해주신 위 줄을 붙이면 내용이 출력되고 역시
내용 다음에 위와 같은 출력이 됩니다.
{$list[$i][wr_content]} 를 {cut_str(get_text($list[$i][wr_content],30)}로
바꾸라는 말씀이시죠? 바꾸면 출력인 아래와 같이..
{cut_str(get_text(Array[wr_content],30)}
그리고 답변해주신 위 줄을 붙이면 내용이 출력되고 역시
내용 다음에 위와 같은 출력이 됩니다.
<?
echo "<img src='$latest_skin_path/img/latest_icon03.gif' border='0'> <font style='font-family:돋움; font-size:8pt; color:#696969;'>";
echo cut_str(get_text($list[$i][wr_content],30);
echo "</font>";
echo "</a>";
?>
echo "<img src='$latest_skin_path/img/latest_icon03.gif' border='0'> <font style='font-family:돋움; font-size:8pt; color:#696969;'>";
echo cut_str(get_text($list[$i][wr_content],30);
echo "</font>";
echo "</a>";
?>
죄송합니다. 다시 한번 봐주세요.
일단 말씀대로 수정부분입니다.
==================================================
.
.
.
<tr>
<td height="1" bgcolor="f9f9f9" colspan="3"></td>
</tr>
<tr>
<td>
<?
echo "<img src='$latest_skin_path/img/latest_icon03.gif' border='0'> <font style='font-family:돋움; font-size:8pt; color:#696969;'>";
echo cut_str(get_text($list[$i][wr_content],30);
echo "</font>";
echo "</a>";
?>
</td>
</tr>
</table>
<? } ?>
</td>
</tr>
.
.
.
==============================================================
에러가 납니다.
Parse error: parse error, unexpected ';' in /home/nikisix/public_html/skin/latest/webzin/latest.skin.php on line 68
라인 68은
echo cut_str(get_text($list[$i][wr_content],30);
입니다.
일단 말씀대로 수정부분입니다.
==================================================
.
.
.
<tr>
<td height="1" bgcolor="f9f9f9" colspan="3"></td>
</tr>
<tr>
<td>
<?
echo "<img src='$latest_skin_path/img/latest_icon03.gif' border='0'> <font style='font-family:돋움; font-size:8pt; color:#696969;'>";
echo cut_str(get_text($list[$i][wr_content],30);
echo "</font>";
echo "</a>";
?>
</td>
</tr>
</table>
<? } ?>
</td>
</tr>
.
.
.
==============================================================
에러가 납니다.
Parse error: parse error, unexpected ';' in /home/nikisix/public_html/skin/latest/webzin/latest.skin.php on line 68
라인 68은
echo cut_str(get_text($list[$i][wr_content],30);
입니다.
헉.. 끝에 ) 하나가 빠진것 같습니다.
echo cut_str(get_text($list[$i][wr_content],30));
echo cut_str(get_text($list[$i][wr_content],30));
네,, 지금 막 확인해보니 그것이 빠진거 같아 추가하고 돌려보니;;;
Warning: Missing argument 2 for cut_str() in /home/nikisix/public_html/lib/common.lib.php on line 941
이런 에러가 나오네요,,;;
일이 점점 커지는거 같은데,, -0-
위 에러 부분은
=============== common.lib.php ========================
.
.
.
/*
// {link:0} ... {link:n} 과 같은 형식
function view_link($view, $number, $attribute)
{
global $config;
if ($view[link][$number][link])
{
if (!preg_match("/target/i", $attribute))
$attribute .= " target='$config[cf_link_target]'";
return "<a href='{$view[link][$number][href]}' $attribute>{$view[link][$number][link]}</a>";
}
else
return "{".$number."번 링크 없음}";
}
*/
// 한글 한글자(2byte, 유니코드 3byte)는 길이 2, 공란.영숫자.특수문자는 길이 1
// 유니코드는 http://g4uni.winnwe.net/bbs/board.php?bo_table=g4uni_faq&wr_id=7 의 Mr.Learn님의 글을 참고하였습니다.
function cut_str($str, $len, $suffix="…")
{
global $g4;
$s = substr($str, 0, $len);
$cnt = 0;
for ($i=0; $i<strlen($s); $i++)
if (ord($s[$i]) > 127)
$cnt++;
if (strtoupper($g4['charset']) == 'UTF-8')
$s = substr($s, 0, $len - ($cnt % 3));
else
$s = substr($s, 0, $len - ($cnt % 2));
if (strlen($s) >= strlen($str))
$suffix = "";
return $s . $suffix;
}
.
.
.
===============================================
에러나는 941 라인은
function cut_str($str, $len, $suffix="…")
입니다.
제 혼자 해결하지 못하는 것이 힘드네요,,
Warning: Missing argument 2 for cut_str() in /home/nikisix/public_html/lib/common.lib.php on line 941
이런 에러가 나오네요,,;;
일이 점점 커지는거 같은데,, -0-
위 에러 부분은
=============== common.lib.php ========================
.
.
.
/*
// {link:0} ... {link:n} 과 같은 형식
function view_link($view, $number, $attribute)
{
global $config;
if ($view[link][$number][link])
{
if (!preg_match("/target/i", $attribute))
$attribute .= " target='$config[cf_link_target]'";
return "<a href='{$view[link][$number][href]}' $attribute>{$view[link][$number][link]}</a>";
}
else
return "{".$number."번 링크 없음}";
}
*/
// 한글 한글자(2byte, 유니코드 3byte)는 길이 2, 공란.영숫자.특수문자는 길이 1
// 유니코드는 http://g4uni.winnwe.net/bbs/board.php?bo_table=g4uni_faq&wr_id=7 의 Mr.Learn님의 글을 참고하였습니다.
function cut_str($str, $len, $suffix="…")
{
global $g4;
$s = substr($str, 0, $len);
$cnt = 0;
for ($i=0; $i<strlen($s); $i++)
if (ord($s[$i]) > 127)
$cnt++;
if (strtoupper($g4['charset']) == 'UTF-8')
$s = substr($s, 0, $len - ($cnt % 3));
else
$s = substr($s, 0, $len - ($cnt % 2));
if (strlen($s) >= strlen($str))
$suffix = "";
return $s . $suffix;
}
.
.
.
===============================================
에러나는 941 라인은
function cut_str($str, $len, $suffix="…")
입니다.
제 혼자 해결하지 못하는 것이 힘드네요,,
헉 죄송합니다. 다음처럼 변경해주세요.
echo cut_str(get_text($list[$i][wr_content]),30);
echo cut_str(get_text($list[$i][wr_content]),30);
감사합니다.. 이제 잘~~~~ 적용이 되었습니다.
수고해 주셨습니다.
다시 한번 신경써주셔서 감사합니다.
앞으로도 일들이 많을 거? 같으니 염치없게 또 부탁드릴께요,,;;
수고해 주셨습니다.
다시 한번 신경써주셔서 감사합니다.
앞으로도 일들이 많을 거? 같으니 염치없게 또 부탁드릴께요,,;;