AI박프로

최근게시물에서 글자수 자르기(latest.skin.php)

· 17년 전 · 4849 · 1
latest.skin.php에서

{$list[$i][name]}
{$list[$i]['subject']}
{$list[$i][wr_content]}
({$list[$i][wr_1]}

위같이 간단하게 사용하면 잘나타나는데

아래같이 하면 글자수 잘려서 몇자만 나타난다는데 안됩니다.
{get_text(cut_str($list[$i]['subject'], 12))}
{get_text(cut_str($list[$i]['wr_content'], 5))}


아래 //날짜표시 같이 이걸 넣고해봣는데도 안됩니다.

$wr_subject = get_text(cut_str($list[$i][wr_subject], 12));
$wr_6 = cut_hangul_last(cut_str($$list[$i][wr_6],5));
$wr_1 = cut_hangul_last(cut_str($list[$i][wr_1],120)); //리스트 페이지일 경우

여분필드나 내용의 글자수를 잘라 latest.skin.php 에 넣으려면 어떻게 해야하는지 좀 알려주세요,

도와주십쇼*^^*



====== 예시 =============================================

<?
//날짜표시
$date1 = substr($list[$i][datetime],0,10); //날짜표시형식변경
$date = explode("-", $date1);
$year = $date[0];
$month = $date[1];
$day = $date[2];
$latest_date = $month."월".$day."일";

echo $list[$i]['icon_reply'] . " ";
echo "<a href='{$list[$i]['href']}'>";
if ($list[$i]['is_notice'])
echo "{$list[$i][name]}:({$list[$i][wr_4]}):{$list[$i]['subject']}:{$list[$i][wr_content]}";
else
echo "{$list[$i][name]}:({$list[$i][wr_4]}):{$list[$i]['subject']}:{$list[$i][wr_content]}";
echo "</a>";
if ($list[$i]['comment_cnt'])
echo " <a href=\"{$list[$i]['comment_href']}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
?>
|

댓글 1개

두가지 함수 결합형인 아래 함수를 사용해 보세요.

conv_subject($subject, $len, $suffix="")

사용예시> conv_subject($list[$i]['subject'], 20, "…");

그런데 기본적으로 latest함수에서 제목의 길이를 지정하니까 위의 예제는 필요없겠죠?

내용도 잘라서 보여주려면 게시판 환경설정에서 "목록에서 내용 미리보기"를 설정 해야만 가능합니다.

만약 강제로 잘라서 보여주려면 common.lib.php파일에 다음 내용을 찾아서

//(주석) if ($board['bo_use_list_content'])
//(주석) {
$html = 0;
if (strstr($list['wr_option'], "html1"))
$html = 1;
else if (strstr($list['wr_option'], "html2"))
$html = 2;

$list['content'] = conv_content($list['wr_content'], $html);
//(주석) }

주석처리 하시면 아래와 같이 사용 가능합니다.

conv_subject($list[$i]['content'], 40, "…");

참고가 되셨길 바랍니다.
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
17년 전 조회 1,692
17년 전 조회 2,326
17년 전 조회 1,911
17년 전 조회 1,652
17년 전 조회 1,814
17년 전 조회 1,885
17년 전 조회 1,575
17년 전 조회 2,185
17년 전 조회 1,666
17년 전 조회 4,850
17년 전 조회 1,965
17년 전 조회 1,634
17년 전 조회 1,806
17년 전 조회 1,508
17년 전 조회 1,650
17년 전 조회 1,680
17년 전 조회 1,500
17년 전 조회 1,684
17년 전 조회 1,632
17년 전 조회 1,755
🐛 버그신고