모이자에서 사용하는 통합추출최근게시물에 관하여... 0

ryuu | 2006.07.03 09:48:12 답변: 5 조회: 940
분류기타 https://life.moyiza.kr/qna/2205162
모이자에서 사용하는 통합추출최근게시물을 공개할수 있나요?엔지오에서 찾아봐도 모이자에서 사용하는 통합추출최근게시물이 없어서요.꼭 쓰고 싶은데 어떻게 만들수 있는 방법이라도 알려주셨으면 고맙습니다.

* 엔죠라이프님에 의해서 게시물 이동되었습니다 (2006-07-03 22:44)
* 이동한 이유 : 적합한 게시판으로 이동합니다.
* 원래의 위치 : 자료실 >> 자료요청 게시판
* 이동후 위치 : 메인 페이지 >> 질문/답변 게시판
IP: ♡.149.♡.49
5개의 답변이 있습니다.
엔죠라이프 (♡.201.♡.97) - 2006/07/03 10:35:35

$conn = mysql_connect(localhost,11,123) or message(mysql_error()); //localhost默认主机地址,数据库名,密码
mysql_select_db(11, $conn ) or message(mysql_error()); //数据库名称

// Function Recent Comment
function recent_cmt($num=10, $textlen=30, $datetype="Y年m月d日 H分i秒") {
global $_zb_url, $connect, $t_board, $t_comment, $mb_id, $mb_conf, $t_category;

// get and set variable
$id = $mb_id; // get IDs
$cutTimeMode = $mb_conf[timemode]; // get time mode
$tc = 0; //Total Counts

// timeMode (1: in 24 hours; 2: today;)
if($cutTimeMode == 1){
$cut_time = time() - 3600 * 24; // 24hours
}else if($cutTimeMode == 2){
$cut_time = mktime(0,0,0,date("m"),date("d"),date("Y")); // today
}else{
$cut_time = 0; // normal
}

// get values from database
for( $i = 0; $i < sizeof($id); $i++){
// get subject data
$query = "select * from ".$t_board."_".$id[$i]." where reg_date > $cut_time order by no desc limit $num";
$result = mysql_query($query, $connect) or die(mysql_error());

while($data=mysql_fetch_array($result)){
// subject data
$cmt[$tc][no] = $data[no];
$cmt[$tc][name] = stripslashes($data[name]);
$cmt[$tc][parent] = $data[parent];
$cmt[$tc][date] = date($datetype, $data[reg_date]);
$cmt[$tc][reg_date] = $data[reg_date];
$cmt[$tc][memo] = cut_str(stripslashes($data[subject]), $textlen);

// get parent data
$p_data = mysql_fetch_array(mysql_query("select * from $t_comment"."_$id[$i] where no='$data[parent]'"));
$cmt[$tc][p_subject] = cut_str(stripslashes($p_data[subject]), 100);
$cmt[$tc][p_name] = stripslashes($p_data[name]);
$cmt[$tc][p_date] = date($datetype, $p_data[reg_date]);
$cmt[$tc][p_target] = $_zb_url."view.php?id=".$id[$i]."&no=".$data[no];

// ready for sorting
$tm[$tc] = $data[reg_date]."_$tc";
$map[$data[reg_date]."_$tc"] = $tc;

$tc++;
}
}
// sort by time
if($tc)
sort($tm);

// output

for($i = sizeof($tm)-1; $i >= sizeof($tm)-$num && $i >= 0; $i--){
$n = $map[$tm[$i]];


<font color=blue>print</font> "<font color=red><</font>tr>";
<font color=blue>print</font>" <font color=red><</font>td height=24 align=left>·[".$cmt[$n][name]."]";
<font color=blue>print</font> "<font color=red><</font>a href=".$cmt[$n][p_target].">";
<font color=blue>print</font> $cmt[$n][memo]."<font color=red><</font>/a><font color=red><</font>/td>";
<font color=blue>print</font>"<font color=red><</font>tr>";
}


게시물 수출용
<font color=red><</font>?
$mb_id = array("w1", "w2", "w3", "w4"); //w1,w2,w3,w4는 게시판 아이디.
$mb_conf[timemode] = 0;
recent_cmt(8,24);
?<font color=red>></font>

의견 쓰기
ryuu (♡.149.♡.142) - 2006/07/03 13:16:31

빠른답변 감사합니다.
윗부분의 소스를 폴드로 만들어 게시물 추출할 페이지 상단에 인쿨루드해서 사용하나요?
완전 초보라서 ...
사용방법좀 상세히 알려주시면 고맙겠습니다.

의견 쓰기
ryuu (♡.149.♡.142) - 2006/07/03 14:56:50

outlogin.php 마지막에 넣으서 할려니까 에러가 나서 마지막에 } 이걸 하나 더 부치니까 되네요.그리고 아래 부분에서
print "&lt;tr&gt;";
print" &lt;td height=24 align=left&gt;·[".$cmt[$n][name]."]";
print "&lt;a href=".$cmt[$n][p_target]."&gt;";
print $cmt[$n][memo]."&lt;/a&gt;&lt;/td&gt;";
print"&lt;tr&gt;";
이데로 사용하니까 홈페이지 테이블이 깨져서
print "&lt;table&gt;";
print "&lt;tr&gt;";
print" &lt;td height=24 align=left&gt;·[".$cmt[$n][name]."]";
print "&lt;a href=".$cmt[$n][p_target]."&gt;";
print $cmt[$n][memo]."&lt;/a&gt;&lt;/td&gt;";
print"&lt;/tr&gt;";
print"&lt;/table&gt;";
}
}
이렇게 고치니까 잘 나오네요.
혹시 수정한 부분이 틀렸으면 알려주세요.
아무튼 감사합니다.

의견 쓰기
ryuu (♡.149.♡.142) - 2006/07/03 14:57:49

아~그리고마지막 부분에 print"&lt;tr&gt;"; 이걸 print"&lt;/tr&gt;"; 이렇게 고쳐주야 하네요~

의견 쓰기
엔죠라이프 (♡.20.♡.154) - 2006/07/03 21:41:07

제가 적어준 소스를 페이지 상단에 복사해주시고요(계정에 맞게 적어주셔야 합니다. 즉 디비 정보)
그리고 아래 게시물 수출용
<font color=red><</font>?
$mb_id = array("w1", "w2", "w3", "w4"); //w1,w2,w3,w4는 게시판 아이디.
$mb_conf[timemode] = 0;
recent_cmt(8,24);
?<font color=red>></font>소스를 원하는 곳에 카피해주시면 됩니다.
outlogin.php활용안하셔도 됩니다.

의견 쓰기
제목 상태 답변수 글쓴이 날짜
3
sally
06/03/29
1
sally
06/03/29
0
경우
06/03/29
0
하얀 장미
06/03/29
1
sally
06/03/29
1
민들레꽃
06/03/29
0
BenQ
06/03/29
5
종국이
06/03/29
0
종국이
06/03/29
0
영이
06/03/28
0
서 연
06/03/28
1
zzzz
06/03/28
0
강태공
06/03/28
0
딸기향
06/03/27
0
타임
06/03/27
1
샹하이
06/03/27
0
김정치
06/03/27
0
만남
06/03/27
2
한담
06/03/26
2
행복을함께
06/03/26
모이자 모바일