게시판 헤더파일에 임의의 게시물 1개만 추출하고싶습니다.
게시판 헤더파일에 임의의 게시물 1개만 추출하고싶습니다.
게시판 헤더파일에 최근글추출코드를 넣으니 작동을안하네요,,,
그래서 랜덤광고 뿌려지는 파일을 수정해서 인클루드 하고싶은데 어떻게 수정해야될지 몰라서 질문 좀 드리겠습니다.
<? include_once("{$g4['path']}/aaa.php"); ?> 이렇게 불러올려고합니다.
aaa.php 라고했을때... 아래내용을 어떻게 바꿔야하는지 좀 도와주세요.
랜덤으로 글 제목하나만 뽑아올려고 합니다.
<?
$tmp_table = "게시판명";
$sql = " select wr_id, wr_subject, wr_1 from {$g4[write_prefix]}{$tmp_table}
where wr_is_comment = '0'
and substring(wr_datetime,1,10) = date_sub(curdate(), interval 1 day) ";
$sql .= " order by rand() limit 1 ";
$row = sql_fetch($sql);
if ($row[wr_id])
{
$href = "$g4[bbs_path]/board.php?bo_table={$tmp_table}&wr_id={$row[wr_id]}&no=1";
echo "<a href='$href'>".conv_subject($row[wr_subject],40,"")."</a>";
$tmp_table = "게시판명";
$sql = " select wr_id, wr_subject, wr_1 from {$g4[write_prefix]}{$tmp_table}
where wr_is_comment = '0'
and substring(wr_datetime,1,10) = date_sub(curdate(), interval 1 day) ";
$sql .= " order by rand() limit 1 ";
$row = sql_fetch($sql);
if ($row[wr_id])
{
$href = "$g4[bbs_path]/board.php?bo_table={$tmp_table}&wr_id={$row[wr_id]}&no=1";
echo "<a href='$href'>".conv_subject($row[wr_subject],40,"")."</a>";
// View
sql_query(" update {$g4[write_prefix]}{$tmp_table} set wr_2 = wr_2 + 1 where wr_id = '$row[wr_id]' ");
}
else
{
$href = "$g4[bbs_path]/board.php?bo_table={$tmp_table}";
echo "<a href='$href'>등록된 글이 없습니다</a>";
}
?>
sql_query(" update {$g4[write_prefix]}{$tmp_table} set wr_2 = wr_2 + 1 where wr_id = '$row[wr_id]' ");
}
else
{
$href = "$g4[bbs_path]/board.php?bo_table={$tmp_table}";
echo "<a href='$href'>등록된 글이 없습니다</a>";
}
?>
|
댓글을 작성하시려면 로그인이 필요합니다.
댓글 2개
$g4[path]/lib/latest.lib.php 파일은 넣으셨는지요...