게시판 이미지 없을 때 대체 이미지 (노이미지) 출력하는 방법 좀... > 그누4 질문답변

그누4 질문답변

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

게시판 이미지 없을 때 대체 이미지 (노이미지) 출력하는 방법 좀... 정보

게시판 이미지 없을 때 대체 이미지 (노이미지) 출력하는 방법 좀...

본문

안녕하세요. 사이트를 만들고 있는데...php 지식도 없고, 초보라 몇 시간을 헤매다

글 남깁니다.


최신글 스킨에서 이미지가 없을 때 노이미지로 출력을 하고 싶은데...

어떻게 해야하는지...

다른 스킨들은 이미지가 없을 때 나오는 경로가 소스 안에 있는데 이건 없더라구요

그래서 만들어서 해야할 것 같은데...이것저것 해봤는데 제 실력으로는 어림도 없네요.

어떻게 해야하는지 방법 좀 가르쳐주시면 정말 고맙겠습니다.


<?

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

$list = array();

$tmp = "";
$sql= " select bo_table from {$g4['board_table']} where gr_id='$gr_id' and bo_use_search='1' ";
$result = sql_query($sql);
for($i=0; $i<$board=sql_fetch_array($result); $i++){
  $tmp_write_table = $g4['write_prefix'] . $board['bo_table'];
$tmp .= " select '{$board['bo_table']}' as bo_table, wr_id, wr_subject, wr_content, wr_good, wr_hit, wr_last from $tmp_write_table where wr_is_comment=0 and date_format(wr_datetime, '%Y%m%d') between '$startYmd' and '$nowYmd' UNION ALL ";
}
if($tmp) $tmp = "select * from ( ".substr($tmp,0,-10).") as a order by wr_good desc, wr_hit desc limit 4";
$result = sql_query($tmp); 
for ($i=0; $row=sql_fetch_array($result); $i++){
$sql = "select * from {$g4['board_table']} where bo_table='$row[bo_table]'";
$board = sql_fetch($sql);

$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
$list[$i]['bo_table'] = $board['bo_table'];
}

?>





<table width="360" height="135" border="1" bordercolor="#e1e1e1" cellpadding="0" cellspacing="0" style="BORDER-COLLAPSE: collapse" align=center>
<tr>
    <td valign=center>
        <table width="340" border="0" cellpadding="0" cellspacing="0" align=center>
        <tr>
            <td>
                <script type="text/javascript">
                var COUNT = new Array();
                function layer(id, no)
                {
                for(var i = 0; i < COUNT[id]; i++) document.getElementById(id + "_" + i).style.display = "none";
                document.getElementById(id + "_" + no).style.display = "block";
                return;
                }
                </script><script type="text/javascript">COUNT["recipe_my"] = 4;</script>
                <table border=0 cellpadding="0" cellspacing="0" width="100%" height="120">
                <tr><td height="6" colspan="2"></td></tr>
                <tr>
                    <td colspan="2">
                        <table cellpadding="0" cellspacing="0" width="100%" >
                        <tr>
                            <td valign="top">
<? for ($i=0; $i<count($list); $i++) { ?>

                                <div id="recipe_my_<?=$i?>" style="display:<?if($i==0) echo "block;";else echo "none;";?>">
                                    <table border='0' cellpadding='0' cellspacing='0'>
                                    <tr>
                                        <td align='center'>
                                            <table width=100% cellpadding="0" cellspacing="0" bordercolor="#222222" border="1" style="BORDER-COLLAPSE: collapse">
                                            <tr>
                                                <td><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$list[$i][bo_table]?>&wr_id=<?=$list[$i][wr_id]?>'><img src='<?=$g4[path]?>/data/file/<?=$list[$i][bo_table]?>/thumbnail/<?=$list[$i][wr_id]?>' width='102' height='78' border='0'  /></a></td>
                                            </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td height=7 bgcolor='#FFFFFF' align=center></td>
                                    </tr>
                                    <tr>
                                        <td height=24 bgcolor='#323232' align=center><font color='#FFFFFF'><b><?=cut_str($list[$i][wr_subject],21,"...")?></b></font></td>
                                    </tr>
                                    </table>
                                </div>
<?}?>
                            </td>
                            <td width="100%" style="padding-left:10;">
                                <table cellpadding="0" cellspacing="0" width="100%">
                                <tr><td height='20'><b><font color='#56B3D2'>[맛집] 베스트글</font></b></td></tr>
                                <tr><td height='1' bgcolor='#EBEBEB'></td></tr>
                                <tr><td height='3'></td></tr>
<? for ($i=0; $i<count($list); $i++) { ?>
                                <tr><td height="22"><img src="<?=$latest_skin_path?>/images/i_bullet.gif" align="absmiddle"> <a href="./bbs/board.php?bo_table=<?=$list[$i][bo_table]?>&wr_id=<?=$list[$i][wr_id]?>" style='font-size:12px; color:#555555; vertical-align:1px;'><span OnMouseOver="this.style.fontWeight='bold'"  OnMouseOut="this.style.fontWeight=''"><?=$list[$i][subject]?></span></a>&nbsp;&nbsp;<span style='font-size:8pt;font-family:tahoma;color:#56B3D2;vertical-align:1px;'><img src="<?=$latest_skin_path?>/images/icon_re.gif"> <?=$list[$i][wr_good]?></span>&nbsp;&nbsp;<span style='font-size:8pt;font-family:tahoma;color:#fda83a;vertical-align:1px;'><img src="<?=$latest_skin_path?>/images/icon_hit.gif"> <?=$list[$i][wr_hit]?></span></td></tr>
<?}?>
                                </table>
                            </td>
                        </tr>
                       
                        </table>
                    </td>
                </tr>
                </table>

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

댓글 전체

<td><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$list[$i][bo_table]?>&wr_id=<?=$list[$i][wr_id]?>'><img src='<?=$g4[path]?>/data/file/<?=$list[$i][bo_table]?>/thumbnail/<?=$list[$i][wr_id]?>' width='102' height='78' border='0'  /></a></td>

위 부분 아래로 대체 후 테스트 해 보세요.

<td>
<?
$img = $g4[path]."/data/file/".{$list[$i][bo_table]}."/thumbnail/".$list[$i][wr_id];
if(!@is_file($img)) $img = $g4[path]."/img/noimage.gif"; // noimg경로 수정
?>
<a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$list[$i][bo_table]?>&wr_id=<?=$list[$i][wr_id]?>'>
<img src='<?=$img?>' width='102' height='78' border='0'  />
</a>
</td>
© SIRSOFT
현재 페이지 제일 처음으로