안녕하세요.
최신글 첫번째 게시물(가장 최근 게시물)만 본문내용을 출력하고,
이후 나머지 글은 제목만 출력하고 싶습니다.
아래는 현재 사용중인 최신글 스킨(latest.skin.php) 입니다.
현재는 모든 글에 본문내용이 출력되고 있습니다.
어떻게 수정해야할까요? 답변 부탁드리겠습니다.
Copy
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);
add_javascript('<script src="'.G5_JS_URL.'/jquery.bxslider.js"></script>', 10);
?>
<div class="notice">
<ul>
<?php for ($i=0; $i<count($list); $i++) { ?>
<li>
<?php
//echo $list[$i]['icon_reply']." ";
echo "<a href=\"".$list[$i]['href']."\">";
if ($list[$i]['is_notice'])
echo "<strong>".$list[$i]['subject']."</strong>";
else
echo $list[$i]['subject'];
if ($list[$i]['comment_cnt'])
echo $list[$i]['comment_cnt'];
echo "</a>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
//if ($list[$i]['icon_file']) echo " <i class=\"fa fa-download\" aria-hidden=\"true\"></i>" ;
//if ($list[$i]['icon_link']) echo " <i class=\"fa fa-link\" aria-hidden=\"true\"></i>" ;
//if ($list[$i]['icon_hot']) echo " <i class=\"fa fa-heart\" aria-hidden=\"true\"></i>";
$content = cut_str(preg_replace("@<.*?>@","", $list[$i]['wr_content']),90); // 내용 자르기
echo "<p class=\"news_text\">".$content;
echo "</p>"
?>
<span class="lt_date"><?php echo $list[$i]['datetime2'] ?></span>
</li>
<?php } ?>
<?php if (count($list) == 0) { //게시물이 없을 때 ?>
<li class="empty_li">게시물이 없습니다.</li>
<?php } ?>
</ul>
</div>
답변 2개 / 댓글 3개
채택된 답변
+20 포인트
if($i == "0") {
$content = cut_str(preg_replace("@<.*?>@","", $list[$i]['wr_content']),90); // 내용 자르기
echo "<p class=\"news_text\">".$content;
echo "</p>"
}
i값이 0일때만 ??
답변에 대한 댓글 2개
6년 전
if($i==0) {
$content = cut_str(preg_replace("@<.*?>@","", $list[$i]['wr_content']),90); // 내용 자르기
echo "<p class=\"news_text\">".$content;
echo "</p>"
}
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.