내가 쓴글 확인 쏘스 좀 봐주세요. 이미지첨부.
본문
2번이 짤렸는데. 2번은 게시물이 끝나는 부분에 댓글이 있을경우 표시를 해주는 것입니다.
이 곳의 전문가분들은.. 금방이잖아요.
하루종일 이것 가지고 게시판에 질문 올리고 헤매다... 답변 올라왔을때 적용해 보고 그리고...안됐을때의 절망감
여러분은 아시나요? ㅠㅠ
정말 머리 터지기 일보직전입니다.ㅠㅠ
꼭! 좀 도움 부탁드립니다.
<?
include_once("./_common.php");
$g4[title] = "최근 게시물";
include_once("./_head.php");
$mb_id = $_GET['mb_id'];
if(!$mb_id){
$mb_id = $_POST['mb_id'];
if(!$mb_id){
$mb_id = $member[mb_id];
}
}
$gr_id = "";
if(!$view){$view = "";}
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' ";
if ($gr_id)
$sql_common .= " and b.gr_id = '$gr_id' ";
if ($view == "w")
$sql_common .= " and a.wr_id = a.wr_parent ";
else if ($view == "c")
$sql_common .= " and a.wr_id <> a.wr_parent ";
if ($mb_id)
$sql_common .= " and a.mb_id = '$mb_id' ";
$sql_order = " order by a.bn_id desc ";
$sql = " select count(*) as cnt $sql_common ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$rows = $config[cf_new_rows];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$group_select = "<select name=gr_id id=gr_id onchange='select_change();'><option value=''>전체그룹";
$sql = " select gr_id, gr_subject from $g4[group_table] order by gr_id ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$group_select .= "<option value='$row[gr_id]'>$row[gr_subject]";
}
$group_select .= "</select>";
$list = array();
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
$sql_common
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
if ($row[wr_id] == $row[wr_parent]) // 원글
{
$comment = "";
$comment_link = "";
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$name = get_sideview($row2[mb_id], cut_str($row2[wr_name], $config[cf_cut_name]), $row2[wr_email], $row2[wr_homepage]);
// 당일인 경우 시간으로 표시함
$datetime = substr($row2[wr_datetime],0,10);
$datetime2 = $row2[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
}
else // 코멘트
{
$comment = "[코] ";
$comment_link = "#c_{$row[wr_id]}";
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_parent]' ");
$row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$list[$i][mb_id] = $row3[mb_id];
$list[$i][wr_name] = $row3[wr_name];
$list[$i][wr_email] = $row3[wr_email];
$list[$i][wr_homepage] = $row3[wr_homepage];
$name = get_sideview($row3[mb_id], cut_str($row3[wr_name], $config[cf_cut_name]), $row3[wr_email], $row3[wr_homepage]);
// 당일인 경우 시간으로 표시함
$datetime = substr($row3[wr_datetime],0,10);
$datetime2 = $row3[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
}
$list[$i][gr_id] = $row[gr_id];
$list[$i][bo_table] = $row[bo_table];
$list[$i][name] = $name;
$list[$i][comment] = $comment;
$list[$i][href] = "./board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]{$comment_link}";
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$list[$i][gr_subject] = $row[gr_subject];
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][wr_subject] = $row2[wr_subject];
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "{$PHP_SELF}?view=$view&page=");
$new_skin_path = "$g4[path]/skin/new/$config[cf_new_skin]";
echo "<script type=\"text/javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
?>
<!-- 분류 시작 -->
<form name=fnew method=get style="margin:0px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height=30>
<?=$group_select?>
<select id=view name=view onchange="select_change()">
<option value=''>전체게시물
<option value='w'>원글만
<option value='c'>코멘트만
</select>
<script type="text/javascript">
function select_change()
{
document.fnew.submit();
}
document.getElementById("gr_id").value = "<?=$gr_id?>";
document.getElementById("view").value = "<?=$view?>";
</script>
</td>
</tr>
</table>
</form>
<!-- 분류 끝 -->
<!-- board_list-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="4" height="33" bgcolor="#7BB2D6"><img src="<?=$new_skin_path?>/img/list_top_01.gif" width="4" height="33"></td>
<td width="100" align="center" bgcolor="#7BB2D6" height="30"><font class=n_title1><strong>그룹</strong></font></td>
<td width="5" align="center" valign="middle" bgcolor="#7BB2D6"><img src="<?=$new_skin_path?>/img/list_top_02.gif" width="5" height="33"></td>
<td width="5" align="center" valign="middle" bgcolor="#EEEEEE"><img src="<?=$new_skin_path?>/img/list_top_03.gif" width="5" height="33"></td>
<td width="100" align="center" bgcolor="#EEEEEE"><font class=n_title2><strong>게시판</strong></font></td>
<td width="" align="center" bgcolor="#EEEEEE"><font class=n_title2><strong>제목</strong></font></td>
<td width="120" align="center" bgcolor="#EEEEEE"><font class=n_title2><strong>이름</strong></font></td>
<td width="60" align="center" bgcolor="#EEEEEE"><font class=n_title2><strong>일시</strong></font></td>
<td width="4" bgcolor="#EEEEEE"><img src="<?=$new_skin_path?>/img/list_top_04.gif" width="4" height="33"></td>
</tr>
<?
for ($i=0; $i<count($list); $i++)
{
$gr_subject = $list[$i][gr_subject];
$bo_subject = $list[$i][bo_subject];
$wr_subject = get_text($list[$i][wr_subject]);
echo <<<HEREDOC
<tr>
<td align="center" height="30" colspan=3><a href='./new.php?gr_id={$list[$i][gr_id]}'>{$gr_subject}</a></td>
<td align="center" colspan=2><a href='./board.php?bo_table={$list[$i][bo_table]}'>{$bo_subject}</a></td>
<td width=""> <a href='{$list[$i][href]}'>{$list[$i][comment]}{$wr_subject}</a></td>
<td align="center">{$list[$i][name]}</td>
<td align="center" colspan=2>{$list[$i][datetime2]}</td>
<!-- <a href="javascript:;" onclick="document.getElementById('mb_id').value='{$list[$i][mb_id]}';">·</a> -->
</tr>
<tr>
<td colspan="9" height="1" background="{$new_skin_path}/img/dot_bg.gif"></td>
</tr>
HEREDOC;
}
?>
<? if ($i == 0) { ?>
<tr><td colspan="3" height=50 align=center>게시물이 없습니다.</td></tr>
<? } ?>
</table>
<?=$write_pages?>
답변 1
1번은 위에서 적으신거 기준으로 61라인에 $comment = '[제목] '; 으로 해주시면 될듯하네요.
2번은 스킨쪽에서 해주셔야 할듯합니다.
new 스킨 보시면 for()문이 나오고 echo <<<HEREDOC 이게 나올겁니다.
echo 바로 위에
if($list[$i][wr_comment]) $comment = " <span class='comment'>{$list[$i][wr_comment]}</span>"; else $comment = "";넣어주시구요
echo 안에 보면
<td width=""> <a href='{$list[$i][href]}'>{$list[$i][comment]}{$wr_subject}</a></td>
이게 있을건데요
<td width=""> <a href='{$list[$i][href]}'>{$list[$i][comment]}{$wr_subject}</a>$comment</td>
이렇게 해보세요.
원하시는게 이게 맞는지 모르겠네요. ^^;
답변을 작성하시기 전에 로그인 해주세요.