최근게시물에서 글자수 자르기(latest.skin.php) 정보
최근게시물에서 글자수 자르기(latest.skin.php)
본문
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'];
?>
{$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'];
?>
댓글 전체
두가지 함수 결합형인 아래 함수를 사용해 보세요.
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, "…");
참고가 되셨길 바랍니다.
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, "…");
참고가 되셨길 바랍니다.