foreach 문에서 개수 조절 방법 좀 알려 주세요

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
foreach 문에서 개수 조절 방법 좀 알려 주세요

QA

foreach 문에서 개수 조절 방법 좀 알려 주세요

본문

메인화면에 겔러리 최신글을 불러오는데

아래 소스로는 최신글 5개가 불려오는데 최신글 2개만 불러 올려면 어떻게 해야 할까요

제가 아직 초보라

누가 좀 알려줘요 ~~~~~~

부탁해요 ~~~~~~

 

 

<? if(count($gallery_list)): ?>

<? foreach($gallery_list as $lt): ?>


                                <p class="s2" style="left: 0px;">
                                 
          <table width="320" border=0  cellspacing=0 cellpadding=0 valign="top"><tr><td valign="top">
           <a href="<?=URL_DIR ?>/board/view/?category=<?=$lt -> category ?>&code=<?=$lt -> code ?>&page=<?=$this -> page ?><?=$this -> params ?>">
                                        <img src="/data/<?=$lt -> fk_name . '/' . $lt -> category . '/' . $lt -> thumb_name ?>" alt="<?=$lt -> title ?>" title="<?=$lt -> title ?>" width="130" height="90"/>
                                    </a>
          </td>
          <td valign="top" align="right">
                                            <a href="/board/view/?category=gallery&code=<?= $lt -> code ?>" class="substr" style="width:160px;">
                                                <? if($lt->summary_name != NULL) : ?>
                                                    <span class="<?= $lt -> summary_color ?>_t">[<?= $lt -> summary_name ?>]</span>
                                                <? endif; ?>
                                             
            <?
                                                if ($lt -> comment_cnt) :
                                                    echo character_limiter($lt -> title, 35) . ' (' . $lt -> comment_cnt . ')';
                                                else :
                                                    echo character_limiter($lt -> title, 35);
                                                endif;

                                                if (substr($lt -> write_date, 0, 10) == date("Y-m-d")) :
                                                    echo " <img src='/images/user/new_main.gif' alt='gallery'>";
                                                endif;
                                                ?>
                                            </a><p>
            <span class="year"><?=substr($lt -> write_date, 0, 10) ?></span>

           </td><td width="20"><!----간격 띄우기----></td></tr></table>
                                        
                                      
         
                                </p>


                            <? endforeach; ?>       
       

                        <? else: ?>
                        <? endif; ?>

이 질문에 댓글 쓰기 :

답변 2

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

회원로그인

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