공지사항을 불러올 때, 공지사항에서 제목과 글 내용을 추출하려고 합니다. > 그누4 질문답변

그누4 질문답변

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

공지사항을 불러올 때, 공지사항에서 제목과 글 내용을 추출하려고 합니다. 정보

공지사항을 불러올 때, 공지사항에서 제목과 글 내용을 추출하려고 합니다.

본문

홈페이지에서 공지사항을 출력하려고 하는데...

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 내용 출력되는 부분은 크게 다른 건 없습니다...

<?
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>&nbsp;&nbsp;
            <?
            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 ($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에서 필드명 보고 수정해주시면 될듯해요.
© SIRSOFT
현재 페이지 제일 처음으로