테이블 어디서 문제인지.. 어렵네요.. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

테이블 어디서 문제인지.. 어렵네요.. 정보

테이블 어디서 문제인지.. 어렵네요..

본문

latest.skin.php 소스인데요.

테이블 정렬이
가운데로 정렬이 되야하는데
내용물이 점차적으로 쏠리네요.. 내려갈수록
어디문제인지 좀...팁좀 주세요 ㅠ



 <?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$cols  = 1; //  이미지 가로갯수 //  이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$image_h  = 10; // 이미지 상하 간격

$col_width = (int)(99 / $cols);
?>
<style type="text/css">
<!--
.data  { font-family:돋움; font-size:8pt; color:#999999; }
-->
</style>

<table width="344" height="162" border="0" cellspacing="5" cellpadding="5"  background="<?=$latest_skin_path?>/img/bg_banner.jpg">
  <tr><? for ($i=0; $i<count($list); $i++) { if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; } ?>
    <td width="<?=$col_width?>%" align="center" valign='top'>
      <table cellpadding=0 cellspacing=0 border=0 width="100%">
        <tr>
          <td align='center' valign=middle>
            <table align="center" cellpadding="0" cellspacing="0" border="0">
              <tr>
                <td align="center" valign='middle'>
                  <table border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td valign="middle">
                        <?
$ex1_filed = explode("|", $list[$i][wr_1]);
$ext1_00  = explode(" ", $ex1_filed[0]);
$ext2_02  = explode(" ", $ex2_filed[2]);
$ext2_09  = explode(" ", $ex2_filed[9]);

    $title = get_text($list[$i][wr_subject]);
    $content = cut_str(get_text($list[$i][wr_content]), 75);
    $img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);
    if (!file_exists($img) || !$list[$i][file][0][file])
    $img = "$latest_skin_path/img/noimage.gif";
    $href = "$g4[bbs_path]/board.php?bo_table=$bo_table";

echo "<table width='100%' border='0' cellspacing='0' cellpadding='5'><tr><td valign=middle align='center'>";
echo "<a href='{$list[$i]['href']}'><img src='{$img}' width='150' height='50' border='0' title='$title'></a><br></td></tr>";
echo "'<tr><td valign=middle align='center'><a href='{$list[$i]['href']}'><b><font color='#0099ff'>{$ext1_00[0]}</font></b></a>";
echo "</td></tr><tr><td bgcolor='#f0f0f0' height='1'></td></tr><tr><td width=$thum_width>";
echo "<a href='{$list[$i]['href']}'><font color='#ff6600'>{$list[$i][ca_name]}</font>&nbsp;&nbsp;</a></td><td>";
echo "<a href='{$list[$i]['href']}'><font style='font-family:돋움; font-size:9pt; color:#333333;'>{$list[$i]['subject']}</a>";
echo "</td></tr></table>";
?>
                        <? if (count($list) == 0) { echo "게시물이 없습니다."; } ?>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>

      </table>
</td>
<? } ?>
  </tr>
</table>
  • 복사

댓글 전체

필요없이 테이블이 많이 들어 갔네요.

<table width="344" height="162" border="0" cellspacing="5" cellpadding="5"  background="<?=$latest_skin_path?>/img/bg_banner.jpg">
  <tr>
  <? for ($i=0; $i<count($list); $i++) {
          if ($i>0 && $i%$cols==0) {
              echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>";
          } ?>
    <td width="<?=$col_width?>%" align="center" valign='top'>

      <table cellpadding=0 cellspacing=0 border=0 width="100%">
        <tr>
          <td align='center' valign=middle>
          <?
            $ex1_filed = explode("|", $list[$i][wr_1]);
            $ext1_00  = explode(" ", $ex1_filed[0]);
            $ext2_02  = explode(" ", $ex2_filed[2]);
            $ext2_09  = explode(" ", $ex2_filed[9]);

            $title = get_text($list[$i][wr_subject]);
            $content = cut_str(get_text($list[$i][wr_content]), 75);
            $img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);
   
            if (!file_exists($img) || !$list[$i][file][0][file])
                $img = "$latest_skin_path/img/noimage.gif";
                $href = "$g4[bbs_path]/board.php?bo_table=$bo_table";

          echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td valign=middle align='center'>";
          echo "<a href='{$list[$i]['href']}'><img src='{$img}' width='150' height='50' border='0' title='$title'></a><br></td></tr>";
          echo "'<tr><td valign=middle align='center'><a href='{$list[$i]['href']}'><b><font color='#0099ff'>{$ext1_00[0]}</font></b></a>";
          echo "</td></tr><tr><td bgcolor='#f0f0f0' height='1'></td></tr><tr><td width=$thum_width>";
          echo "<a href='{$list[$i]['href']}'><font color='#ff6600'>{$list[$i][ca_name]}</font>&nbsp;&nbsp;</a></td><td>";
          echo "<a href='{$list[$i]['href']}'><font style='font-family:돋움; font-size:9pt; color:#333333;'>{$list[$i]['subject']}</a>";
          echo "</td></tr></table>";
?>
          <? if (count($list) == 0) { echo "게시물이 없습니다."; } ?>
          </td>
        </tr>
        </table>

    </td>
<? } ?>
  </tr>
</table>

조금 더 간결하게 해도 될것 같네요.
© SIRSOFT
현재 페이지 제일 처음으로