포럼

으으.. 어렵네요.;;;

2012.12.12 05:13

Canto

아래쪽에 보니까..


일베에 있는 실시간 글 알림 관련 글이 보이길래 한번 애드온으로 만들어 보자 싶어서 해봤는데


어렵네요.. ;; 대충 아래 처럼 해봤는데 제대로 데이터가 빠져나오는지 알수가 없네요.;


디버그 사용법좀 찾아봐야겠네요 ;;



newdocument.addon.php

<?php
    /**
     * 새글이 등록되어있는지 체크
     **/
	if($called_position == 'before_display_content') {
		Context::addJsFile('./addons/newdocument/js/newdocumentdiv.js');
		Context::addJsFile('./addons/newdocument/js/newdocument.js');

	}

	if($called_position == 'before_module_init') {
	
    $is_document_new = false;
    $time_interval = 60;
    $time_check = date("YmdHis", time()-$time_interval);
    $args->list_count = 1;
    $args->order_type = 'asc';
    $db_output = executeQuery('document.getDocumentList', $args);

    if(!$db_output->toBool()) continue;
        if($db_output->data)
        {
           foreach($db_output->data as $doc)
           {
              if($doc->regdate > $time_check)	$is_document_new = true;
           }
        }
		if($is_document_new == true){
        print sprintf('{"new_document_chk" : "Y"},{"document_srl" : "%s"},{"document_title" : "%s"}', $request_uri.$doc->document_srl, $doc->title);
		}
		}
?>


newdocument.js

jQuery(document).ready(newdocumentchk);

function ndc() {
	setTimeout(newdocumentchk, 10000);
}

function newdocumentchk() {
	 jQuery.ajax({
		url : default_url + 'index.php', 
		dataType : "json",
		complete : ndc,
		timeout : 10000,
		success : 
		function(data) {
			if(data.new_document_chk == "Y") {
				$("#ndcLayer").prepend("새로운 글이 올라왔습니다.<br/>제목 : <a href='"+data.document_srl+"' alt=''>"+data.document_title+"</a>");
				$("#ndcLayer").show();
			}
		}
	});
}

newdocumentdiv.js

$(document).ready(function(){
$("body").prepend("<div id='ndcLayer' style='position:absolute;left:0px;top:0px;display:none;width:300px;height:30px;padding:5px;font-size:11px;background:#ffffff;border:2px solid #666666;'></div>");
});


이런식으로 해봤는데 일단 Jquery 쪽 ajax는 갱신이 계속 되는데 데이터가 안들어오는건지.. 표시를 못해주네요 ;;

글쓴이 제목 최종 글
Canto 혹시 xpressengine.org 쪽에 있는 zend_search 사용해보신분 계신가요? [1] 2012.12.18 by lightnsalt
pcdoc 도움 주세요!! [8] 2012.12.19 by pcdoc
Canto 으으.. 어렵네요.;;; [10] 2012.12.20 by Canto
닉 조성재 글 작성시 붙여넣기 문제  
CMD Xzet 1.4.5.16 (XE 1.4.x 보안 패치) - 2012/11/22 [9] 2012.12.21 by 블램블램
hhgyu 테스트 부탁드립니다. [4] 2012.12.21 by 독도2005
컴즈인 모바일EX(모바일확장) 0.2 업데이트 [38] 2012.12.23 by 컴즈인
꿈틀잉 겔러리 형시을 이런식으로 가능한가요? [2] 2012.12.23 by 젠이
jungheasung 홈페이지 주문 제작 요청했는데 사기 당한 것 같습니다. [11] 2012.12.24 by 엠™
이온디 메일 인증이 제대로 안 되네요 [18] 2012.12.25 by misol
숭숭군 윈7에서 개발하기? [19] 2012.12.26 by 숭숭군
푸시아 왜 제로보드에서 XE로 넘어오게 되었나요? [10] 2012.12.27 by 울라탱
Gunmania RSS 게시판 업데이터 쓰시는분 계신가요. [1] 2012.12.29 by Asaph
엡뽀 코어 업데이트 후 회원 목록 증발 현상 해결 [2] 2012.12.28 by 엡뽀
Lansys Canto님의 실시간 등록글 알림 애드온에 디자인을 넣어 보았습니다. [9] file 2012.12.28 by Lansys
lightnsalt innoDB 셋팅 정보 공유 부탁드립니다. [1] 2012.12.28 by 박희망찬삶
Youth 신고 버튼은 왜 있는 것입니까? [9] 2012.12.29 by genosaid
푸시아 모듈의 상업화? [15] 2012.12.30 by 푸시아
블랙비 xe 1.6은 배포하나요?? [11] 2012.12.31 by Garon
CMD Xzet 1.4.5.17 (XE 1.4.x 보안 패치) - 2012/11/29 [8] 2012.12.31 by CMD