최신글 첫번째 게시물만 본문내용 출력하기

최신글 첫번째 게시물만 본문내용 출력하기

QA

최신글 첫번째 게시물만 본문내용 출력하기

본문

안녕하세요.

최신글 첫번째 게시물(가장 최근 게시물)만 본문내용을 출력하고,

이후 나머지 글은 제목만 출력하고 싶습니다.

 

아래는 현재 사용중인 최신글 스킨(latest.skin.php) 입니다.

현재는 모든 글에 본문내용이 출력되고 있습니다.

어떻게 수정해야할까요? 답변 부탁드리겠습니다.

 


<?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

       if($i == "0") {

            $content = cut_str(preg_replace("@<.*?>@","", $list[$i]['wr_content']),90); // 내용 자르기
            echo "<p class=\"news_text\">".$content;
            echo "</p>"

      }

 

i값이 0일때만 ??

if($i==0) {

 $content = cut_str(preg_replace("@<.*?>@","", $list[$i]['wr_content']),90); // 내용 자르기

 echo "<p class=\"news_text\">".$content;

 echo "</p>"
}

답변을 작성하시기 전에 로그인 해주세요.
전체 43
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT