게시글 순서별 배경이 달라지게 하는 방법... 정보
게시글 순서별 배경이 달라지게 하는 방법...첨부파일
본문
최신글로 게시글을 불러오고 있습니다.
현재는
1 A폼
2 A폼
3 A폼
.
.
.
.
이렇게 한가지의 폼으로 적용하였으나,
1 A폼
2 B폼
3 A폼
4 B폼
.
.
.
이렇게 적용하고 싶습니다.
<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image; //썸네일이 없을경우 원본출력
$thumb = $thumb_path. "/". $list[$i][wr_id];
if ( file_exists($thumb) )
$img = $thumb;
$style = "style='font-family:돋움; font-size:9pt; color:#686695;' ";
if ($list[$i][icon_new]) {
$style = "style='font-family:돋움; font-size:9pt; color:#134980;' "; }
$subject = "<span $style>".$list[$i][subject]."</span>"; //제목 글자수 자르기
$wr_hit = $list[$i]['wr_hit'];
$wr_id = $list[$i]['wr_id'];
$wr_2 = $list[$i]['wr_2'];
$wr_3 = $list[$i]['wr_3'];
$wr_4 = $list[$i]['wr_4'];
$wr_5 = $list[$i]['wr_5'];
// if ($list[$i]['comment_cnt']) //코
// $cmt = "({$list[$i]['comment_cnt']})";
$bg = ""; //새글?
if ($list[$i][icon_new])
$bg="la_top_2.gif";
else
$bg="la_top_1.gif";
echo $list[$i][icon_reply] . " ";
echo "<div id='namecard1'>";
echo "<div id='card_center'>";
echo "<table width='720' height='322' border='0' align='left' cellpadding='0' cellspacing='0' background='/homeskin/list_bg01.jpg'><tr valign='top'><td>";
echo "<div id='photo'><a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id' onFocus=\'this.blur();\' title=\'{$list[$i][subject]}'><img src='{$img}' width='175' height='245' border=0' style='border:0 solid #B2BAEE'></a></div></td>";
echo "<td><div id='right'>";
echo "<td><div id='hadeline'><strong>{$wr_2}</strong></div>";
echo "<div id='speka'>{$wr_3}</div>";
echo "<div class='info_txt'><img src='homeskin/namecard_14.png'></div>";
echo "<div id='phon_no'><a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id' onFocus=\'this.blur();\' title=\'{$list[$i][subject]}'>
<img src='homeskin/cardno{$wr_4}.png'></div>";
echo "<div id='button'>
<a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id' onFocus=\'this.blur();\'>
<img src='060/img/tel_01.png' name='state_{$wr_4}' border='0' id='state_{$wr_4}'></a>
<a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id' onFocus=\'this.blur();\'><img src='homeskin/btn_nreview.png' border='0'></a></div>";
echo "</div></td></tr></table></div></div>";
?>
</td>
<? } ?>
<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
echo "<td width=$col_width%> </td>";
}
?>
<? if ($i+1 < count($list)) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; } ?>
<? if (count($list) == 0) { echo "<td height=80 align=center>게시물이 없습니다.</td>"; } ?>
이 부분 인것 같은데....
제 실력으로는 한계네요
어디를 수정하면 이렇게 될까요?
고수님들의 신의한수가 절실합니다~
현재는
1 A폼
2 A폼
3 A폼
.
.
.
.
이렇게 한가지의 폼으로 적용하였으나,
1 A폼
2 B폼
3 A폼
4 B폼
.
.
.
이렇게 적용하고 싶습니다.
<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image; //썸네일이 없을경우 원본출력
$thumb = $thumb_path. "/". $list[$i][wr_id];
if ( file_exists($thumb) )
$img = $thumb;
$style = "style='font-family:돋움; font-size:9pt; color:#686695;' ";
if ($list[$i][icon_new]) {
$style = "style='font-family:돋움; font-size:9pt; color:#134980;' "; }
$subject = "<span $style>".$list[$i][subject]."</span>"; //제목 글자수 자르기
$wr_hit = $list[$i]['wr_hit'];
$wr_id = $list[$i]['wr_id'];
$wr_2 = $list[$i]['wr_2'];
$wr_3 = $list[$i]['wr_3'];
$wr_4 = $list[$i]['wr_4'];
$wr_5 = $list[$i]['wr_5'];
// if ($list[$i]['comment_cnt']) //코
// $cmt = "({$list[$i]['comment_cnt']})";
$bg = ""; //새글?
if ($list[$i][icon_new])
$bg="la_top_2.gif";
else
$bg="la_top_1.gif";
echo $list[$i][icon_reply] . " ";
echo "<div id='namecard1'>";
echo "<div id='card_center'>";
echo "<table width='720' height='322' border='0' align='left' cellpadding='0' cellspacing='0' background='/homeskin/list_bg01.jpg'><tr valign='top'><td>";
echo "<div id='photo'><a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id' onFocus=\'this.blur();\' title=\'{$list[$i][subject]}'><img src='{$img}' width='175' height='245' border=0' style='border:0 solid #B2BAEE'></a></div></td>";
echo "<td><div id='right'>";
echo "<td><div id='hadeline'><strong>{$wr_2}</strong></div>";
echo "<div id='speka'>{$wr_3}</div>";
echo "<div class='info_txt'><img src='homeskin/namecard_14.png'></div>";
echo "<div id='phon_no'><a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id' onFocus=\'this.blur();\' title=\'{$list[$i][subject]}'>
<img src='homeskin/cardno{$wr_4}.png'></div>";
echo "<div id='button'>
<a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id' onFocus=\'this.blur();\'>
<img src='060/img/tel_01.png' name='state_{$wr_4}' border='0' id='state_{$wr_4}'></a>
<a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id' onFocus=\'this.blur();\'><img src='homeskin/btn_nreview.png' border='0'></a></div>";
echo "</div></td></tr></table></div></div>";
?>
</td>
<? } ?>
<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
echo "<td width=$col_width%> </td>";
}
?>
<? if ($i+1 < count($list)) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; } ?>
<? if (count($list) == 0) { echo "<td height=80 align=center>게시물이 없습니다.</td>"; } ?>
이 부분 인것 같은데....
제 실력으로는 한계네요
어디를 수정하면 이렇게 될까요?
고수님들의 신의한수가 절실합니다~
댓글 전체
<?
for ($i=0; $i<count($list); $i++) {
$bg = $i%2 ? 0 : 1;
?>
$bg = $i%2 ? 0 : 1; 를 추가하시고 배경이 나오는 테이블에 <table class="bg<?=$bg?>">라고 적어두시고
스타일을
.bg0 { background:url(원하는 배경이미지)}
.bg1 { background:url(원하는 배경이미지)}
로 하시면 될것 같네요
for ($i=0; $i<count($list); $i++) {
$bg = $i%2 ? 0 : 1;
?>
$bg = $i%2 ? 0 : 1; 를 추가하시고 배경이 나오는 테이블에 <table class="bg<?=$bg?>">라고 적어두시고
스타일을
.bg0 { background:url(원하는 배경이미지)}
.bg1 { background:url(원하는 배경이미지)}
로 하시면 될것 같네요