7

최근글에 카테고리 이름대신 이미지 넣기 해결책 부탁합니다.

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

<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 -->
<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
<td background="<?=$latest_skin_path?>/img/board_title_bg.gif"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><font style='font-family:돋움; font-size:9pt; color:#696969;'><strong><?=$board[bo_subject]?></strong></font></a>&nbsp;</td>
<td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'>more</a></td>
<td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<?
for ($i=0; $i<count($list); $i++)
{
if ($i > 0)
echo "<td>&nbsp;</td>";

$title = get_text($list[$i][wr_subject]);
$content = cut_str(get_text($list[$i][wr_content]), 80);
$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/no_image.gif";
$href = "$g4[bbs_path]/board.php?bo_table=$bo_table";

echo <<<HEREDOC
<td width="120" valign="top">
<table border="1" cellspacing="0" bordercolor="#CCCCCC" bordercolordark="white" bordercolorlight="#CCCCCC">
<tr>
<td width="120" height="100" align="center" valign="middle"><a href='{$list[$i][href]}'><img src="{$img}" width="120" height="100" border="0" title="$title"></a></td>
</tr>
<tr>
<td width="120" align="center">

<a href="<?=$list[$i][ca_name_href]?>"><?if($list[$i][ca_name] == "소식") {
echo "<img src='$latest_skin_path/icon_notice.gif' border=0 >";
} else {
}
?>
<?if($list[$i][ca_name] == "뉴스") {
echo "<img src='$latest_skin_path/img/news.gif' border=0 >";
} else {
}
?>
<?if($list[$i][ca_name] == "이벤트") {
echo "<img src='$latest_skin_path/img/event.gif' border=0 >";
} else {
}
?> </a>{$list[$i][icon_new]}<a href='{$list[$i][href]}'><font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i][subject]}</font></a>{$list[$i][comment_cnt]}</td>
</tr>

</table>
</td>
HEREDOC;
}
?>

</table>

</td></tr></table>
<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 끝 -->

어디에 붙여넣기를 해야하는지 몰라서요^^
로컬에서 테스트중 입니다.
|

댓글 3개

수정된 소스입니다.
HEREDOC 즉 문자열 안에 php문장이 들어있어서 오류가 났던것입니다.
어떻게 할까 하다가 그냥 변수에 담았습니다.

<?
for ($i=0; $i<count($list); $i++)
{
if ($i > 0)
echo "<td> </td>";

$title = get_text($list[$i][wr_subject]);
$content = cut_str(get_text($list[$i][wr_content]), 80);
$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/no_image.gif";
$href = "$g4[bbs_path]/board.php?bo_table=$bo_table";

if($list[$i]['ca_name'] == "소식")
$cat = "<img src='$latest_skin_path/icon_notice.gif' border=0 >";
elseif($list[$i]['ca_name'] == "뉴스")
$cat = "<img src='$latest_skin_path/img/news.gif' border=0 >";
elseif($list[$i]['ca_name'] == "이벤트")
$cat = "<img src='$latest_skin_path/img/event.gif' border=0 >";

echo <<<HEREDOC
<td width="120" valign="top">
<table border="1" cellspacing="0" bordercolor="#CCCCCC" bordercolordark="white" bordercolorlight="#CCCCCC">
<tr>
<td width="120" height="100" align="center" valign="middle"><a href='{$list[$i][href]}'><img src="{$img}" width="120" height="100" border="0" title="$title"></a></td>
</tr>
<tr>
<td width="120" align="center">
<a href="{$list[$i][ca_name_href]}">$cat</a> {$list[$i][icon_new]}<a href='{$list[$i][href]}'><font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i][subject]}</font></a>{$list[$i][comment_cnt]}</td>
</tr>

</table>
</td>
HEREDOC;
}
?>

</table>

</td></tr></table>
<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 끝 -->
정말 감사합니다^^

팁을 2개나 얻어갑니다.
엉뚱하게 넣었으니 나올리가 없죠...하하
덩달아 저도 감사합니다.
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

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

+
제목 글쓴이 날짜 조회
20년 전 조회 2,028
20년 전 조회 2,056
20년 전 조회 2,044
20년 전 조회 2,017
20년 전 조회 1,750
20년 전 조회 1,977
20년 전 조회 2,326
20년 전 조회 2,297
20년 전 조회 2,191
20년 전 조회 2,256
20년 전 조회 1,683
20년 전 조회 2,288
20년 전 조회 2,322
20년 전 조회 1,677
20년 전 조회 2,219
20년 전 조회 1,660
20년 전 조회 1,972
20년 전 조회 2,721
20년 전 조회 2,391
20년 전 조회 1,985
🐛 버그신고