소스좀 정리좀 해주세요~~ > 그누4 질문답변

그누4 질문답변

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

소스좀 정리좀 해주세요~~ 정보

소스좀 정리좀 해주세요~~

본문

소스정리좀 부탁드립니다^^
짜집기를 너무했더니...도무지..정리가 안되네요..
 
---------------------------------------------------------------------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_w = '65';  // 이미지 가로 세로 사이즈
$img_h = '60';
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
?>
<style type="text/css">
<!--
.style1 {
 color: #000000;
 font-weight: bold;
}
-->
</style>
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
<form name="fboardlist" method="post">
    <input type="hidden" name="bo_table" value="<?=$bo_table?>">
    <input type="hidden" name="sfl"  value="<?=$sfl?>">
    <input type="hidden" name="stx"  value="<?=$stx?>">
    <input type="hidden" name="spt"  value="<?=$spt?>">
    <input type="hidden" name="page" value="<?=$page?>">
    <input type="hidden" name="sw"   value="">
  <tr>
    <td width='5' height='5'><img src='<?=$latest_skin_path?>/img/neto1.gif' width='5' height='5' border='0'></td>
    <td width="760" background='<?=$latest_skin_path?>/img/neto2.gif'></td>
    <td width='5'><img src='<?=$latest_skin_path?>/img/neto3.gif' width='5' height='5' border='0'></td>
  </tr>
  <tr>
    <td background='<?=$latest_skin_path?>/img/neto4.gif'></td>
    <td align='center' valign='top' bgcolor='#FFFFFF'>
 

 <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td>  <font color="#003366"><strong>
                  <a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>&sca=<?=urlencode($ca_name)?>'>
                  <?=$ca_name?>
                  </a>                  </strong></font></td>
                <td><div align="right"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src="<?=$latest_skin_path?>/img/more.gif" width="32" height="9" border="0"></a></div></td>
              </tr>
            </table></td>
        </tr>
        <tr>
          <td height="1" bgcolor="#E1E1DD"></td>
        </tr>
        <tr>
          <td height="2"></td>
        </tr>
        <tr>
          <td><? for ($i=0; $i<count($list); $i++) { //이미지와 카테고리 갤러리가 있으면 출력해라
$file = $list[$i][file][0][path].'/'.$list[$i][file][0][file];
if ((preg_match("/\.($config[cf_image_extension])$/i", $file)) && $list[$i][ca_name] == "갤러리") { //첫번째 화일이 이미지이고 카테고리가 갤러리라면
?>     
            <div align="center">
              <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <? for($i=0; $i<count($list); $i++) {$m++;?>
 
                  <td width="75" valign="top"><div align="center">
   
                      <table width="100%" border="0" cellspacing="0">
                        <tr>
                          <td><div align="center">
                              <?
$image = $list[$i][file][0][file]; //원본 리사이즈_아래 자바와 연동_추가
$img=$data_path. "/".$image;  //썸네일이 없을경우 원본출력
$thumb = $thumb_path. "/". $list[$i][wr_id];
  if ( file_exists($thumb) )
   $img = $thumb;
 
    $style_a = "font-family:돋움; font-size:9pt; color:#999999;";
 $style = "font-family:돋움; font-size:9pt; color:#636363;";
    if ($list[$i][icon_new])
    $style = "style='font-family:돋움; font-size:9pt; color:#006F00;' ";
 $subject = "<span $style>".cut_str($list[$i][subject],17)."</span>"; //제목 글자수 자르기
// $subject = "<span $style>". $list[$i][subject]. "</span>";
   // $wr_content = "<a href='{$list[$i][href]}' onfocus='this.blur()'><span $style_a>".Shorten_String(strip_tags($list[$i][wr_content]), 40, ' ...')."</span></a>";
?>
                              <? echo "<a href='{$list[$i][href]}' onfocus='this.blur()'><img src='$img' width='$img_w' height='$img_h' border='0'></a>"; ?>
                            </div></td>
                        </tr>
                        <tr>
                          <td height="2"></td>
                        </tr>
                        <tr> <? for ($i=0; $i<count($list); $i++) { ?>
                            <td valign="top">
                              <?// echo "<a href='{$list[$i][href]}&sca=". urlencode($ca_name). "' onfocus='this.blur()'><font color=#000000>{$subject}</font></a>"; ?>
        <?
        echo $list[$i][icon_reply] . " ";
        echo "<a href='{$list[$i][href]}&sca=". urlencode($ca_name). "'>";
        if ($list[$i][is_notice])
            echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list[$i][subject]}</strong></font>";
        else
            echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i][subject]}</font>";
        echo "</a>";
        if ($list[$i][comment_cnt])
            echo " <a href=\"{$list[$i][comment_href]}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list[$i][comment_cnt]}</span></a>";
      ?>
                      </td>  <? } ?> 
                        </tr>
                      </table>
                    </div></td></div>
                  <? if ($m%6==0){ ?>
                 </tr>
    
                <tr>
                  <? } ?>
                  <? } ?>
                  <? if (count($list) == 0) { echo "<td height=30 align=center>게시물이 없습니다.</td>"; } ?>
                </tr>
              </table>
            <? } else {//그렇지 않으면 ?> 
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td height="10"></td></tr>
<? for ($i=0; $i<count($list); $i++) {$m++; ?>
<tr>
    <td width="40" height="18" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
    <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
        <?
        echo $list[$i][icon_reply] . " ";
        echo "<a href='{$list[$i][href]}&sca=". urlencode($ca_name). "'>";
        if ($list[$i][is_notice])
            echo "<font style='font-family:돋음; font-size:9pt; color:#2C88B9;'><strong>{$list[$i][subject]}</strong></font>";
        else
            echo "<font style='font-family:돋음; font-size:9pt; color:#6A6A6A;'>{$list[$i][subject]}</font>";
        echo "</a>";
        if ($list[$i][comment_cnt])
            echo " <a href=\"{$list[$i][comment_href]}\"><span style='font-family:돋음; font-size:8pt; color:#9A9A9A;'>{$list[$i][comment_cnt]}</span></a>";
        ?>
    </td>
</tr>
<? } ?>
<tr><td height="10"></td></tr>
<? if (count($list) == 0) { ?>
<tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
<? } ?>
</table>
<? } //이미지와 갤러리 ?>
<? }  //이미지와 갤러리?></td>
        </tr>
      </table> </td>
    <td background='<?=$latest_skin_path?>/img/neto5.gif'></td>
  </tr>
  <tr>
    <td height='5'><img src='<?=$latest_skin_path?>/img/neto6.gif' width='5' height='5' border='0'></td>
    <td background='<?=$latest_skin_path?>/img/neto7.gif'></td>
    <td><img src='<?=$latest_skin_path?>/img/neto8.gif' width='5' height='5' border='0'></td>
  </tr>
  </form>
</table>
------------------------------------------------------------------------------
 
이미지 출력되는 부분에서...이미지가 한개밖에 출력이 안되거든요...
이미지1 있을때 && 카테고리==갤러리 일때 출력해라..하는부분...입니다..
 
부탁드립니다..
 
감사합니다^^

댓글 전체

if ((preg_match("/\.($config[cf_image_extension])$/i", $file)) && $list[$i][ca_name] == "갤러리")

이부분에서 조건을 만족하는것이 하나 밖에 없어서 그런 결과가 나오는 것 같은데요.

for 루틴이 바로 실행된다면 조건 부분을 막고 실행시켜 보시고 디버깅을 좀 하셔야 할것 같네요.


// if ((preg_match("/\.($config[cf_image_extension])$/i", $file)) && $list[$i][ca_name] == "갤러리")
이런식으로 테스트...
감사합니다 <? } ?> 하나 다른곳에 붙여 넣어서..이미지가 하나 밖에 안나왔습니다..
제자리에 가따 넣으니 되네요..
너무도 소스가 지저분해서..무지..해깔린담니다..^^
모든분께 감사합니다... 해결은 했는데..소스가 조금 지저분한것 같아서..
고수님들께 정리좀 받을려고 했는데......  모든분들께 포인트 드리고 싶지만..
제일먼저 글남기신 분께....드리겠습니다^^
성의와 관심을 가져주신 모든분 그리고 이 긁을 읽으신 모든분께 감사드립니다^^
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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