공지사항을 불러올 때, 공지사항에서 제목과 글 내용을 추출하려고 합니다. 정보
공지사항을 불러올 때, 공지사항에서 제목과 글 내용을 추출하려고 합니다.본문
홈페이지에서 공지사항을 출력하려고 하는데...
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=32081&page=6 를 참고해서
공지사항을 출력하는 부분까지는 성공했습니다.
공지사항을 출력하면, Skin을 통해 출력이 되다보니
이걸 제목과 글 내용을 추출해서 일반 Text로 출력을 시키려고 합니다.
기존의 공지사항 출력하는 부분에서 무엇을 더 추가해야 이것이 가능할지
다른 분들의 조언 부탁드립니다.
<!!공지사항 출력하는 부분!!>
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest_notice($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
/* 공지사항 출력되지 않게 수정 */
// 답변글 출력제외
$subqry1 = "&& wr_reply = ''";
// 공지사항 출력제외
$arr_notice = split("\n", trim($board[bo_notice]));
for ($k=0; $k<count($arr_notice); $k++) {
$subqry2_1 = " && wr_id!='$arr_notice[$k]'";
$subqry2 = "$subqry2 $subqry2_1";
}
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
/* 옵션 설정 했을 때 공지사항만 출력되게 수정 */
if($options=='notice'){
$notice_rows=count( split("\n", trim($board[bo_notice]) ) );
if( $rows> $notice_rows) $rows= $notice_rows;
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and INSTR('$board[bo_notice]', wr_id)>0 order by wr_num limit 0, $rows ";
}
else
// $sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
// 위의 코드 보다 속도가 빠름
// $sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
$sql = " select * from $tmp_write_table where wr_is_comment = 0 $subqry1 $subqry2 order by wr_id desc limit 0, $rows "; // 수정
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
<<홈페이지에서 공지사항 글을 출력하는 부분>>
<div id="m_board_wide">
<div id="review_box">
<h1><a href="javascript:sub01_06();"><img src="../images/main/m_review.gif" /></a></h1>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="m_review">
<tr>
<td rowspan="2"><div class="box"><img src="../images/main/m_review_best.png" /></div>
<img src="../images/main/m_review_img.gif" /></td>
<th>
<? echo latest_notice("", "review",2,20, "notice"); ?> //공지 제목 출력되야 하는 부분
</th>
</tr>
<tr>
<td>This is notice content area</td> //공지 내용 출력되야 하는 부분
</tr>
</table>
<p><img src="../images/main/m_review_bar.gif" /></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="review">
<colgroup>
<col width="*">
<col width="60px" align="right">
</colgroup>
<?
//$sql = "SELECT * FROM g4_write_review where wr_option not in ('html1,secret', 'secret') order by wr_id desc limit 0,3";
$sql = "SELECT *, left(wr_datetime,10) as reg_date FROM g4_write_review where wr_reply not in ('A') AND wr_is_comment=0 order by wr_id desc limit 0,3 ";
$result = mysql_query($sql);
while($rs=mysql_fetch_array($result))
{
?>
<tr>
<th height="20"><a href="../sub01/sub01_06.html?wr_id=<?=$rs["wr_id"]?>">
<?=mb_substr($rs['wr_subject'],0,50)?>
</a></th>
<td><?=$rs['reg_date']?></td>
</tr>
<? } ?>
</table>
</div>
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=32081&page=6 를 참고해서
공지사항을 출력하는 부분까지는 성공했습니다.
공지사항을 출력하면, Skin을 통해 출력이 되다보니
이걸 제목과 글 내용을 추출해서 일반 Text로 출력을 시키려고 합니다.
기존의 공지사항 출력하는 부분에서 무엇을 더 추가해야 이것이 가능할지
다른 분들의 조언 부탁드립니다.
<!!공지사항 출력하는 부분!!>
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest_notice($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
/* 공지사항 출력되지 않게 수정 */
// 답변글 출력제외
$subqry1 = "&& wr_reply = ''";
// 공지사항 출력제외
$arr_notice = split("\n", trim($board[bo_notice]));
for ($k=0; $k<count($arr_notice); $k++) {
$subqry2_1 = " && wr_id!='$arr_notice[$k]'";
$subqry2 = "$subqry2 $subqry2_1";
}
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
/* 옵션 설정 했을 때 공지사항만 출력되게 수정 */
if($options=='notice'){
$notice_rows=count( split("\n", trim($board[bo_notice]) ) );
if( $rows> $notice_rows) $rows= $notice_rows;
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and INSTR('$board[bo_notice]', wr_id)>0 order by wr_num limit 0, $rows ";
}
else
// $sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
// 위의 코드 보다 속도가 빠름
// $sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
$sql = " select * from $tmp_write_table where wr_is_comment = 0 $subqry1 $subqry2 order by wr_id desc limit 0, $rows "; // 수정
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
<<홈페이지에서 공지사항 글을 출력하는 부분>>
<div id="m_board_wide">
<div id="review_box">
<h1><a href="javascript:sub01_06();"><img src="../images/main/m_review.gif" /></a></h1>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="m_review">
<tr>
<td rowspan="2"><div class="box"><img src="../images/main/m_review_best.png" /></div>
<img src="../images/main/m_review_img.gif" /></td>
<th>
<? echo latest_notice("", "review",2,20, "notice"); ?> //공지 제목 출력되야 하는 부분
</th>
</tr>
<tr>
<td>This is notice content area</td> //공지 내용 출력되야 하는 부분
</tr>
</table>
<p><img src="../images/main/m_review_bar.gif" /></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="review">
<colgroup>
<col width="*">
<col width="60px" align="right">
</colgroup>
<?
//$sql = "SELECT * FROM g4_write_review where wr_option not in ('html1,secret', 'secret') order by wr_id desc limit 0,3";
$sql = "SELECT *, left(wr_datetime,10) as reg_date FROM g4_write_review where wr_reply not in ('A') AND wr_is_comment=0 order by wr_id desc limit 0,3 ";
$result = mysql_query($sql);
while($rs=mysql_fetch_array($result))
{
?>
<tr>
<th height="20"><a href="../sub01/sub01_06.html?wr_id=<?=$rs["wr_id"]?>">
<?=mb_substr($rs['wr_subject'],0,50)?>
</a></th>
<td><?=$rs['reg_date']?></td>
</tr>
<? } ?>
</table>
</div>
댓글 전체
latest skin을 하나 더 추가해서 내용만 나오게 수정을 해서 사용해야 될꺼 같네요
skin 내용 출력되는 부분이 없어서 어떻게 판단을 못하겠네요
아니면 skin에서 제목 출력되는부분 내용출력되는부분을 수정해서 사용하는게 가장 답이긴하는데..
skin 내용 출력되는 부분이 없어서 어떻게 판단을 못하겠네요
아니면 skin에서 제목 출력되는부분 내용출력되는부분을 수정해서 사용하는게 가장 답이긴하는데..
SKIN 내용 출력되는 부분은 크게 다른 건 없습니다...
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table width=100% cellpadding=0 cellspacing=0>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td colspan=4 align=center>
<table width=95%>
<tr>
<td height=25>
<?
echo $list[$i]['icon_reply'] . " ";
echo "<a href='{$list[$i]['href']}'>";
if ($list[$i]['is_notice'])
{
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font><p>";
echo "{$list[$i]['content']}";
}
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>";
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
?></td></tr>
<tr><td bgcolor=#EBEBEB height=2.5></td></tr>
</table></td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><tr><td colspan=4 align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>
</table>
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table width=100% cellpadding=0 cellspacing=0>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td colspan=4 align=center>
<table width=95%>
<tr>
<td height=25>
<?
echo $list[$i]['icon_reply'] . " ";
echo "<a href='{$list[$i]['href']}'>";
if ($list[$i]['is_notice'])
{
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font><p>";
echo "{$list[$i]['content']}";
}
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>";
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
?></td></tr>
<tr><td bgcolor=#EBEBEB height=2.5></td></tr>
</table></td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><tr><td colspan=4 align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>
</table>
일반 Text 로 출력한다는것이 어떤것을 출력한다는것이죠?
말 그대로 단순 텍스트로 출력하는 걸 뜻하는 겁니다 ㅎㅎ.
skin을 거치지 않고 제목하고 내용을 텍스트로 바로 출력한다는건가요?
skin을 거쳐서 내용만 일반 텍스트로 바로 출력하려고 합니다.
제목은 앞에 태그를 건드니 어느정도 해결이 되네요...
제목은 앞에 태그를 건드니 어느정도 해결이 되네요...
if ($list[$i]['is_notice'])
{
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font><p>";
echo "{$list[$i]['content']}";
}
else
이부분을지우고
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['content']}</font>"
content로 안나오면 wr_content db에서 필드명 보고 수정해주시면 될듯해요.
{
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font><p>";
echo "{$list[$i]['content']}";
}
else
이부분을지우고
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['content']}</font>"
content로 안나오면 wr_content db에서 필드명 보고 수정해주시면 될듯해요.
감사합니다. 덕분에 해결했습니다.