기간제 최신글문의

· 2010-08-21 (토) 14:33:37 · 1638 · 4
<?=$write[wr_7]?> 에 종료일이 들어가는 게시판스킨인데요.

기간이종료되면 게시물이 리스트에 접속을 해야 삭제됩니다.

wr_7 입력된 기간이 지난게시물 최신글 출력을 안할려면 어떻게해야하나요?

아래처럼 해서 안되는거 같네요.

latest.lib.php


[code]

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

$current_time = time();
$opentime = date("Ymd", $current_time); // 컬랜트 타임을 일반시간으로 전환

// 시간 지났나 알아내기
function after_check($wr_arr) {

$result = 0;
if (strtotime($wr_arr[wr_7]) < time())
$result = 1;

return $result;
}

//랜덤게시물 추출 방법
function r_latest($skin_dir="", $bo_table, $rows=10, $subject_len=40)
{
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);

$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_7 >='$opentime' order by rand() 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;
}

function gga_image_size($x, $y, $thumbx, $thumby) {
if($x > $thumbx) {
$overx = ($x - $thumbx) / $x;
$x = $thumbx;
$y = intval($y - ($y * $overx));
}
if($y > $thumby) {
$overy = ($y - $thumby) / $y;
$y = $thumby;
$x = intval($x - ($x * $overy));
}

return array('x'=>$x, 'y'=>$y);
}

function get_thumb_filename2($num, $seq)
{
return sprintf("%05d", $num) . "_" . sprintf("%03d", $seq);}

?>

[/code]

이렇게해서않되나요?

홈이네님의 게시판스킨입니다.

http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=85383
|

댓글 4개

특정게시물을 기간값을 적용하여 삭제하려면 이벤트가 발생하여야 겠지요

하지만 서버에서 무조건삭제를 하여야하는 문제가 밠행하는군요

1. 서버에 타이머기능을 넣은 응용프로그램을 까셔야 하지 않을까요?
2. 님글처럼 특정이벤트는 웹페이지가 불러질때 검사를 하여 삭제가 가능하겠지요

즉 이벤트를 발생시켜줄려면 페이지 호출이 아니면 1안 처럼 하시는 방법...............
2010-08-22 (일) 02:49:33
카운트 다운을 해서 이벤트값을 주는것 밖에 없겠네요. 서버에다가 별도 프로그램 설치하거나,
보조컴퓨터로 페이지 접속하게 한다음에 시간에 따라 자료 갱신 요청하게 만들어 놓으면 될거같네요~
2010-08-22 (일) 13:05:55
//랜덤게시물 추출 방법

function r_latest($skin_dir="", $bo_table, $rows=10, $subject_len=40) {

global $g4, $opentime; //-- 1. 변수 추가
//$opentime = date("Y-m-d"); //-- 2. 날짜 지정을 함수 안에서

//$sql = " select * from $tmp_write_table where wr_7 >='$opentime' order by rand() desc limit 0, $rows ";

$sql = " select * from $tmp_write_table where wr_7 >= now() order by rand() desc limit 0, $rows ";

//-- 3. 날짜 함수( now()) 사용


wr_7은 date( datetime)으로 타입 변경....
어떻게 감사들 들여야할지...몇일 고생한게 해결되었네요.
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

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

+
제목 글쓴이 날짜 조회
10-08-22 조회 1,653
10-08-22 조회 1,651
10-08-22 조회 1,620
10-08-22 조회 1,592
10-08-21 조회 1,984
10-08-21 조회 1,631
10-08-21 조회 1,877
10-08-21 조회 1,662
10-08-21 조회 1,652
10-08-21 조회 1,639
10-08-21 조회 1,753
10-08-21 조회 1,610
10-08-21 조회 9,416
10-08-21 조회 2,316
10-08-20 조회 1,666
10-08-20 조회 1,647
10-08-20 조회 2,593
10-08-20 조회 2,888
10-08-20 조회 1,889
10-08-20 조회 1,784