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

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
최신글 첫번째 게시물만 본문내용 출력하기

QA

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

답변 2

본문

안녕하세요.

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

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

 

아래는 현재 사용중인 최신글 스킨(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>"
}

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 36
© SIRSOFT
현재 페이지 제일 처음으로