최신글 제목길이 자르기 도움 부탁드립니다. 채택완료
안녕하세요~
G4용 스킨을 G5로 수정해서 쓰려 합니다.
다른건 질답게시판을 찾아보며 수정하긴 했는데 제목길이가 그누 g4에서 사용할땐 이상없이 잘 적용되었는데
g5에서는 안잘리네요 어떻게 해야될지요...
latest.skin.php 소스 22~24 라인이 제목이 나오는 부분 같은데 php실력이 미천하여 봐도 모르겠습니다.ㅜㅜ
부탁드립니다.~
latest.skin.php 소스입니다.
</p><p><?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);
if ($izen_sort == 'wr_hit')
{
$sub_title = "주간 인기글";
}
?>
<!-- <?php echo $bo_subject; ?> 최신글 시작 { -->
<div class="today_best_side">
<ul>
<?php for ($i=0; $i<count($list); $i++) { ?>
<li>
<?php
echo "<span class='rank'>";
echo sprintf("%2d", ($i+1));
echo "</span>";
echo " <a href='{$list[$i]['href']}'>";
//echo "{$list[$i]['subject']}";
if ($list[$i]['is_notice'])
<span style="color: rgb(255, 0, 0);">echo "{$list[$i]['wr_subject']}";</span>
<span style="color: rgb(255, 0, 0);"> else</span>
<span style="color: rgb(255, 0, 0);"> echo "{$list[$i]['wr_subject']}";</span>
<span style="color: rgb(255, 0, 0);"> echo "</a>";</span>
<span style="color: rgb(255, 0, 0);"> </span>
<span style="color: rgb(0, 0, 0);"> //if ($list[$i]['comment_cnt'])</span>
<span style="color: rgb(0, 0, 0);"> //echo " <a href=\"{$list[$i]['comment_href']}\"><span class='comment'>{$list[$i]['comment_cnt']}</span></a>";</span>
<span style="color: rgb(0, 0, 0);"> ?></span>
<span style="color: rgb(0, 0, 0);"> </li></span>
<span style="color: rgb(0, 0, 0);"> <? } ?></span>
<span style="color: rgb(0, 0, 0);"> <?php if (count($list) == 0) { //게시물이 없을 때 ?></span>
<span style="color: rgb(0, 0, 0);"> <li>게시물이 없습니다.</li></span>
<span style="color: rgb(0, 0, 0);"> <?php } ?></span>
<span style="color: rgb(0, 0, 0);"> </ul></span>
<span style="color: rgb(0, 0, 0);"></div></span>
<span style="color: rgb(0, 0, 0);"><!-- } <?php echo $bo_subject; ?> 최신글 끝 --></span></p><p><span style="color: rgb(0, 0, 0);">
weekly.lib.php 소스입니다.
</span></p><p><span style="color: rgb(0, 0, 0);"><?php </span>
<span style="color: rgb(0, 0, 0);">if (!defined('_GNUBOARD_')) exit; </span>
<span style="color: rgb(0, 0, 0);">/* </span>
<span style="color: rgb(0, 0, 0);">izen.group.lib.php </span>
<span style="color: rgb(0, 0, 0);">제작일 : 2006-12-08 </span>
<span style="color: rgb(0, 0, 0);">지정 기간제 히트순 최근 게시물 수정본 </span>
<span style="color: rgb(0, 0, 0);"><a href="<a href="http://www.sir.co.kr/bbs/tb.php/g4_tiptech/7328" target="_blank" rel="noopener noreferrer">http://www.sir.co.kr/bbs/tb.php/g4_tiptech/7328</a>"><a href="http://www.sir.co.kr/bbs/tb.php/g4_tiptech/7328" target="_blank" rel="noopener noreferrer">http://www.sir.co.kr/bbs/tb.php/g4_tiptech/7328</a></a> </span>
<span style="color: rgb(0, 0, 0);">그룹 최신글 관련하여 통합하도록 하였다. </span>
<span style="color: rgb(0, 0, 0);">정렬 필드값에 의해서 SQL 문을 추가하도록 하면 된다. </span>
<span style="color: rgb(0, 0, 0);">izen_group('스킨', '그룹명', 정렬필드, 출력갯수, 자를 문자열, 최근 몇일간을 출력할 것인가?); </span>
<span style="color: rgb(0, 0, 0);">예) echo izen_group('best10', '06', wr_hit, 10, 28, 30); </span>
<span style="color: rgb(0, 0, 0);">*/ </span>
<span style="color: rgb(0, 0, 0);"># 인기글 </span>
<span style="color: rgb(0, 0, 0);">function izen_usort1($a, $b) </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">return $b['wr_hit'] - $a['wr_hit']; </span>
<span style="color: rgb(0, 0, 0);">} </span>
<span style="color: rgb(0, 0, 0);"># 헤드라인 </span>
<span style="color: rgb(0, 0, 0);">function izen_usort2($a, $b) </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">return $b['wr_good'] - $a['wr_good']; </span>
<span style="color: rgb(0, 0, 0);">} </span>
<span style="color: rgb(0, 0, 0);"># 최신글 추출 </span>
<span style="color: rgb(0, 0, 0);">function izen_group($skin_dir="", $gr_id, $izen_sort, $rows=10, $subject_len=40, $listdate) </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">global $g5; </span>
<span style="color: rgb(0, 0, 0);">$nowYmd = date(Ymd); # 시작시간을 구합니다. </span>
<span style="color: rgb(0, 0, 0);">$time = time(); </span>
<span style="color: rgb(0, 0, 0);">$startYmd = date("Ymd",strtotime("-".$listdate." day", $time)); </span>
<span style="color: rgb(0, 0, 0);">if (!$skin_dir) $skin_dir = 'basic';</span>
<span style="color: rgb(0, 0, 0);"> if(G5_IS_MOBILE) {</span>
<span style="color: rgb(0, 0, 0);"> $latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;</span>
<span style="color: rgb(0, 0, 0);"> $latest_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;</span>
<span style="color: rgb(0, 0, 0);"> } else {</span>
<span style="color: rgb(0, 0, 0);"> $latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;</span>
<span style="color: rgb(0, 0, 0);"> $latest_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;</span>
<span style="color: rgb(0, 0, 0);"> }</span>
<span style="color: rgb(0, 0, 0);">$list = array(); </span>
<span style="color: rgb(0, 0, 0);">$sql= " select bo_table from {$g5['board_table']} "; </span>
<span style="color: rgb(0, 0, 0);">$ress = sql_query($sql); </span>
<span style="color: rgb(0, 0, 0);">for($i=0, $ii=0; $board=sql_fetch_array($ress); $ii++) </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">$tmp_write_table = $g5['write_prefix'] . $board['bo_table']; # 게시판 테이블 전체이름 </span>
<span style="color: rgb(0, 0, 0);">#$sql = "select * from `$tmp_write_table` where wr_is_comment <> '1' and date_format(wr_datetime, '%Y%m%d') between '$startYmd' and '$nowYmd' order by $sort desc limit 0, $rows "; </span>
<span style="color: rgb(0, 0, 0);"># 정렬 필드에 의해서 전체적으로 정렬, 관리한다. </span>
<span style="color: rgb(0, 0, 0);">if ($izen_sort == 'wr_hit') </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">$sql_gr_Q = " wr_is_comment <> '1' and date_format(wr_datetime, '%Y%m%d') between '$startYmd' and '$nowYmd' order by $izen_sort desc limit 0, $rows "; </span>
<span style="color: rgb(0, 0, 0);">} </span>
<span style="color: rgb(0, 0, 0);">elseif ($izen_sort == 'wr_scrap') </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">$sql_gr_Q = " wr_is_comment <> '1' and date_format(wr_datetime, '%Y%m%d') between '$startYmd' and '$nowYmd' and wr_scrap <> 0 order by $izen_sort desc limit 0, $rows "; </span>
<span style="color: rgb(0, 0, 0);">} </span>
<span style="color: rgb(0, 0, 0);">elseif ($izen_sort == 'wr_datetime') # wr_1 헤드라인 </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">$sql_gr_Q = " wr_is_comment <> '1' and date_format(wr_datetime, '%Y%m%d') between '$startYmd' and '$nowYmd' and wr_1 = 1 order by $izen_sort desc limit 0, $rows "; </span>
<span style="color: rgb(0, 0, 0);">} </span>
<span style="color: rgb(0, 0, 0);">elseif ($izen_sort == 'wr_good') # </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">$sql_gr_Q = " wr_is_comment <> '1' and date_format(wr_datetime, '%Y%m%d') between '$startYmd' and '$nowYmd' and wr_good <> '0' order by $izen_sort desc limit 0, $rows "; </span>
<span style="color: rgb(0, 0, 0);">} </span>
<span style="color: rgb(0, 0, 0);">elseif ($izen_sort == 'wr_id') </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">$sql_gr_Q = " wr_is_comment <> '1' order by $izen_sort desc limit 0, $rows "; </span>
<span style="color: rgb(0, 0, 0);">}</span>
<span style="color: rgb(0, 0, 0);">$sql = " select * from `$tmp_write_table` where $sql_gr_Q "; </span>
<span style="color: rgb(0, 0, 0);">$result = sql_query($sql); </span>
<span style="color: rgb(0, 0, 0);">#for (; $row=sql_fetch_array($result); $i++) # *오류* 전체 게시물 가운데 날짜에 상관없이 히트순으로 지정한 갯수만큼 출력된다. </span>
<span style="color: rgb(0, 0, 0);">for ($i==0; $row=sql_fetch_array($result); $i++) </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">$list[$i] = get_list($row, $board, $latest_skin_url, $subject_len, $listdate); </span>
<span style="color: rgb(0, 0, 0);">} </span>
<span style="color: rgb(0, 0, 0);">} </span>
<span style="color: rgb(0, 0, 0);">if ($izen_sort == 'wr_hit') </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">usort($list, 'izen_usort1'); </span>
<span style="color: rgb(0, 0, 0);">} </span>
<span style="color: rgb(0, 0, 0);">elseif ($izen_sort == 'wr_good') </span>
<span style="color: rgb(0, 0, 0);">{ </span>
<span style="color: rgb(0, 0, 0);">usort($list, 'izen_usort2'); </span>
<span style="color: rgb(0, 0, 0);">} </span>
<span style="color: rgb(0, 0, 0);">$list= array_slice($list, 0, $rows); </span>
<span style="color: rgb(0, 0, 0);">ob_start();</span>
<span style="color: rgb(0, 0, 0);">include $latest_skin_path.'/latest.skin.php';</span>
<span style="color: rgb(0, 0, 0);">$content = ob_get_contents(); </span>
<span style="color: rgb(0, 0, 0);">ob_end_clean(); </span>
<span style="color: rgb(0, 0, 0);">return $content; } ?></span></p><p><span style="color: rgb(0, 0, 0);">
스킨원본 주소 : http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=76978&sca=&sfl=wr_subject||wr_content&stx=%EC%9D%B8%EA%B8%B0&page=4">http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=76978&sca=&sfl=wr_subject||wr_content&stx=%EC%9D%B8%EA%B8%B0&page=4
답변 2개
function izen_group($skin_dir="", $gr_id, $izen_sort, $rows=10, $subject_len, $listdate)
이렇게 한번 고쳐보세요~
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
if ($list[$i]['is_notice']) |
22 | echo "{$list[$i]['wr_subject']}"; //공지사항일경우 |
23 | else |
24 | echo "{$list[$i]['wr_subject']}"; //일반글일경우 |
23 | # 최신글 추출 |
24 | function izen_group($skin_dir="", $gr_id, $izen_sort, $rows=10, $subject_len=40, $listdate) |
| { |
$subject_len=40, 이 부분이 글자수 조정하는곳이구요
실제로는
echo izen_group('best10', '06', wr_hit, 10, 글자수, 30);
로 지정하겠네요
답변에 대한 댓글 1개
그런데 최신글을 <?php echo izen_group("best10", "", wr_hit, 10, 40, 7); ?> 이런식으로 불러 들일때 말씀하신 글자수에 해당하는 곳에 숫자를 명시해도 (* 예문에선 글자수를 40으로 썻습니다.) 긴 제목은 그대로 노출되어서 올린 질문입니다.
[code]
if ($list[$i]['is_notice'])
echo "{$list[$i]['wr_subject']}"; //공지사항일경우
else
echo "{$list[$i]['wr_subject']}"; //일반글일경우
[/code]
스밀리에님께서 설명해 주신 부분이 최신글에서 제목이 나오는 부분이 맞는거 같은데 질답 게시판을
찾아보면 저 제목 나오는 부분에 함수(?) 같은걸 직접적으로 적어서 해결하는거 같아서요...
(참고로 질답게시판에서 고수님들이 답변해주신 방법대로 적용해봐도 해결이 안되었습니다 ㅜㅜ php는 까막눈이라 제대로 적용하지 못해서 그런걸수도 있지만.....)
무튼 관심 가져 주셔서 감사합니다^^
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
감사합니다 ^^