이미지 두개씩 나오게 하려면

이미지 두개씩 나오게 하려면

QA

이미지 두개씩 나오게 하려면

답변 1

본문

아래 소스는 이미지가 하나씩 출력되는데 

한줄에 두개의 이미지가 출력되도록 하고 싶은데 어디를 수정해야 할지요 ?

ㅠㅠ


 <div class="container">
    <div id="slides">
      <?php
        for ($i=0; $i<count($list); $i++) {
          //썸네일 생성
          $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $imgwidth, $imgheight);
          if($thumb['src']) {
            $img_content = '<img class="img_left" src="'.$thumb['src'].'" alt="'.$list[$i]['subject'].'" width="'.$imgwidth.'" height="'.$imgheight.'">';
          } else {
            $img_content = 'NO IMAGE';
          }
 
          if ($list[$i][wr_link1]) {
            if ($list[$i][wr_link2] == "none") {
              echo "{$img_content}";
            } elseif ($list[$i][wr_link2] == "_blank") {
              echo "<a href='{$list[$i][wr_link1]}' target='_blank'>{$img_content}</a>";
            } elseif ($list[$i][wr_link2] == "_self") {
              echo "<a href='{$list[$i][wr_link1]}'>{$img_content}</a>";
            } else {
              if ($list[$i][wr_link1]) { 
                echo "<a href='{$list[$i][wr_link1]}' target='_blank'>{$img_content}</a>";
              } else { 
                echo "<a href='{$list[$i][href]}'>{$img_content}</a>";
              }
            }
          } else {
            echo "{$img_content}";
          }
        }
        if (count($list) == 0) { 
          echo "<center><font color=#6A6A6A>새소식이 없습니다.</font></center>";
        } 
      ?>
    </div>
  </div>

이 질문에 댓글 쓰기 :

답변 1

1) if($thumb['src']) {
            $img_content = '<img class="img_left" src="'.$thumb['src'].'" alt="'.$list[$i]['subject'].'" width="'.$imgwidth.'" height="'.$imgheight.'">';
          }

->

if($thumb['src']) {
            $img_content = '<div><img class="img_left" src="'.$thumb['src'].'" alt="'.$list[$i]['subject'].'" width="'.$imgwidth.'" height="'.$imgheight.'"></div>';
          }

 

2) 

</div>
  </div>

->

</div>
  </div>

 

<style>

.container .slides div {

  float:left;

  width:47%;

}

.container .slides div:nth-child(2n+1) {
    clear: both;
}

</style>

답변을 작성하시기 전에 로그인 해주세요.
전체 3
© SIRSOFT
현재 페이지 제일 처음으로