채택완료

질문 드립니다.

최근게시물 스킨을 다운받아 아래 부분을 수정 하고자 합니다.

게시물 순서에 따라 제목밑의 배경 이미지가 바뀌게 할려합니다. (3개정도)

아래 코드를 어떻게 변경 해야 하나요?

최신글

Copy
<div class="gya"> <div class="slider01"> <?php for ($i=0; $i<count($list); $i++) { ?>     <div class="slide sbox">     <a href="<?php echo $list[$i]['href'] ?>">     <?php                         $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $imgwidth, $imgheight);                              if($thumb['src']) {             $img_content = '<img src="'.$thumb['src'].'" alt="'.$list[$i]['subject'].'" width="" height="">';          } else {             $img_content = 'NO IMAGE';          }                          echo $img_content;                                  ?>       </a>      <div class="gy_cotent">   <strong><a href="<?php echo $list[$i]['href'] ?>"><?php echo cut_str($list[$i]['name'], 80, "..") ?></a></strong>         </div>        </div>    <?php } ?>    <? if (count($list) == 0) { //게시물이 없을 때 ?>    게시물이 없습니다.    <? } ?>    </div>   </div>

css

Copy
.gya .gy_cotent { margin:0;position:absolute; width:100%; height:70px;line-height:70px; z-index:10; top:340px; background:url('./img/gallery_title.png') center no-repeat; }.gya .gy_cotent a:link {color:#FFF;text-decoration:none;padding-right:10px;}.gya .gy_cotent a:visited {color:#FFF;text-decoration:none; }.gya .gy_cotent a:hover, a:focus, a:active {color:#FFF;text-decoration:none; } .gya .slider01 { text-align:right; height:130px;font-size:1.2em;  } .gya .slider01 .slide { display:inline; } .gya .sbox { background:#fff;width:300px; height:400px; border:0px solid #cdcdcd; }.gya .sbox img { margin:0 auto;padding-top:10px;width:280px; height:370px; border:0px solid #cdcdcd; } .gya .sbox_over img { margin:0 auto;padding-top:10px;width:300px; height:400px; border:0px solid #ff0000; }
 

<div class="gy_cotent<? echo $i ?>">로 바꾸고

css 부분에

Copy
.gya .gy_cotent1 { margin:0;position:absolute; width:100%; height:70px;line-height:70px; z-index:10; top:340px; background:url('./img/gallery_title01.png') center no-repeat; }  .gya .gy_cotent2 { margin:0;position:absolute; width:100%; height:70px;line-height:70px; z-index:10; top:340px; background:url('./img/gallery_title02.png') center no-repeat; }  .gya .gy_cotent3 { margin:0;position:absolute; width:100%; height:70px;line-height:70px; z-index:10; top:340px; background:url('./img/gallery_title03.png') center no-repeat; }

이러면 3개는 되는데 다시 처음의 gy_cotent1로 돌아가지 못해 드린 질문입니다. 

|

답변 1개 / 댓글 1개

채택된 답변
+20 포인트

<?php $j = 0; for ($i=0; $i<count($list); $i++) { if($i==0 || $j == 3 ) $j = 0; $j++; ?>

$i를 $j 로 변경

답변에 대한 댓글 1개

답변 감사합니다

답변을 작성하려면 로그인이 필요합니다.