글자수 제한 어떻게 하죠 정보
글자수 제한 어떻게 하죠본문
배추스킨에 있는 인기글에 나오는 제목을 줄이려합니다
아래는 배추스킨에 있는 인기글 스크립트 입니다.
인기글을적용하면제목이모두나오잖아요...
이제목의글을제한할순없을까요?
이아래는인기글스크립트입니다
<? /** * Bechu-Basic Skin for Gnuboard4 * * Copyright (c) 2008 Choi Jae-Young <www.miwit.com> * * This program is free software; you can redistribute it and/or modify * it under the termsof the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *** 개인정보보호를 위한 전화번호 노출방지 *** USA */if (!defined("_GNUBOARD_")) exit; // 개별페이지접근불가 ?>
<style type="text/css"> #mw_basic #mw_basic_hot_list li.hot_icon_1 { background:url(<?=$board_skin_path?>/img/icon_hot_1.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_2 { background:url(<?=$board_skin_path?>/img/icon_hot_2.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_3 { background:url(<?=$board_skin_path?>/img/icon_hot_3.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_4 { background:url(<?=$board_skin_path?>/img/icon_hot_4.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_5 { background:url(<?=$board_skin_path?>/img/icon_hot_5.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_6 { background:url(<?=$board_skin_path?>/img/icon_hot_6.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_7 { background:url(<?=$board_skin_path?>/img/icon_hot_7.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_8 { background:url(<?=$board_skin_path?>/img/icon_hot_8.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_9 { background:url(<?=$board_skin_path?>/img/icon_hot_9.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_10 { background:url(<?=$board_skin_path?>/img/icon_hot_10.gif) no-repeat left 2px; } </style>
<? if ($mw_basic[cf_hot]) { ?> <? switch ($mw_basic[cf_hot]) { case "1": $hot_start = ""; $hot_title = "실시간"; break; case "2": $hot_start = date("Y-m-d H:i:s", $g4[server_time]-60*60*24*7); $hot_title = "주간"; break; case "3": $hot_start = date("Y-m-d H:i:s", $g4[server_time]-60*60*24*30); $hot_title = "월간"; break; case "4": $hot_start = date("Y-m-d H:i:s", $g4[server_time]-60*60*24); $hot_title = "일간"; break; } $sql_between = 1; if ($mw_basic[cf_hot] > 1) { $sql_between = " wr_datetime between '$hot_start' and '$g4[time_ymdhis]' "; } $sql_except = ""; $tmp = explode("\n", $board[bo_notice]); for ($i=0, $m=sizeof($tmp); $i<$m; $i++) { if (!trim($tmp[$i])) continue; $bo_notice[] = trim($tmp[$i]); } if (count($bo_notice)>0) $sql_except = " and wr_id not in (".implode(",", $bo_notice).") "; $sql = "select * from $write_table where wr_is_comment = 0 and $sql_between $sql_except order by wr_{$mw_basic[cf_hot_basis]} desc limit 10"; $qry = sql_query($sql); ?> <div id=mw_basic_hot_list> <h3> <?=$hot_title?> 인기게시물</h3> <ul class=mw_basic_hot_dot> <? for ($i=0; $row = sql_fetch_array($qry); $i++) { ?> <? $row[wr_subject] = mw_reg_str($row[wr_subject]); ?> <li class=hot_icon_<?=($i+1)?>> <nobr><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>&wr_id=<?=$row[wr_id]?>"><?=cut_str($r ow[wr_subject], 40)?></a></nobr> </li> <? if (($i+1)%5==0) echo "</ul><ul>"; ?> <? } ?> </ul> </div> <? } ?>
아래는 배추스킨에 있는 인기글 스크립트 입니다.
인기글을적용하면제목이모두나오잖아요...
이제목의글을제한할순없을까요?
이아래는인기글스크립트입니다
<? /** * Bechu-Basic Skin for Gnuboard4 * * Copyright (c) 2008 Choi Jae-Young <www.miwit.com> * * This program is free software; you can redistribute it and/or modify * it under the termsof the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *** 개인정보보호를 위한 전화번호 노출방지 *** USA */if (!defined("_GNUBOARD_")) exit; // 개별페이지접근불가 ?>
<style type="text/css"> #mw_basic #mw_basic_hot_list li.hot_icon_1 { background:url(<?=$board_skin_path?>/img/icon_hot_1.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_2 { background:url(<?=$board_skin_path?>/img/icon_hot_2.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_3 { background:url(<?=$board_skin_path?>/img/icon_hot_3.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_4 { background:url(<?=$board_skin_path?>/img/icon_hot_4.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_5 { background:url(<?=$board_skin_path?>/img/icon_hot_5.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_6 { background:url(<?=$board_skin_path?>/img/icon_hot_6.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_7 { background:url(<?=$board_skin_path?>/img/icon_hot_7.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_8 { background:url(<?=$board_skin_path?>/img/icon_hot_8.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_9 { background:url(<?=$board_skin_path?>/img/icon_hot_9.gif) no-repeat lef t 2px; } #mw_basic #mw_basic_hot_list li.hot_icon_10 { background:url(<?=$board_skin_path?>/img/icon_hot_10.gif) no-repeat left 2px; } </style>
<? if ($mw_basic[cf_hot]) { ?> <? switch ($mw_basic[cf_hot]) { case "1": $hot_start = ""; $hot_title = "실시간"; break; case "2": $hot_start = date("Y-m-d H:i:s", $g4[server_time]-60*60*24*7); $hot_title = "주간"; break; case "3": $hot_start = date("Y-m-d H:i:s", $g4[server_time]-60*60*24*30); $hot_title = "월간"; break; case "4": $hot_start = date("Y-m-d H:i:s", $g4[server_time]-60*60*24); $hot_title = "일간"; break; } $sql_between = 1; if ($mw_basic[cf_hot] > 1) { $sql_between = " wr_datetime between '$hot_start' and '$g4[time_ymdhis]' "; } $sql_except = ""; $tmp = explode("\n", $board[bo_notice]); for ($i=0, $m=sizeof($tmp); $i<$m; $i++) { if (!trim($tmp[$i])) continue; $bo_notice[] = trim($tmp[$i]); } if (count($bo_notice)>0) $sql_except = " and wr_id not in (".implode(",", $bo_notice).") "; $sql = "select * from $write_table where wr_is_comment = 0 and $sql_between $sql_except order by wr_{$mw_basic[cf_hot_basis]} desc limit 10"; $qry = sql_query($sql); ?> <div id=mw_basic_hot_list> <h3> <?=$hot_title?> 인기게시물</h3> <ul class=mw_basic_hot_dot> <? for ($i=0; $row = sql_fetch_array($qry); $i++) { ?> <? $row[wr_subject] = mw_reg_str($row[wr_subject]); ?> <li class=hot_icon_<?=($i+1)?>> <nobr><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>&wr_id=<?=$row[wr_id]?>"><?=cut_str($r ow[wr_subject], 40)?></a></nobr> </li> <? if (($i+1)%5==0) echo "</ul><ul>"; ?> <? } ?> </ul> </div> <? } ?>
댓글 전체
<?=cut_str($r ow[wr_subject], 40)?>
그누보드 함수 중 cut_str이 글자수를 조정하는 함수입니다. cut_str(문자열, 제한글자, [제한표시 디폴트:... (생략가능)])
그누보드 함수 중 cut_str이 글자수를 조정하는 함수입니다. cut_str(문자열, 제한글자, [제한표시 디폴트:... (생략가능)])
감사합니다 ^_^
substr 도 있어용 이건 몇자만큼 자르기