웹마스터 팁
글을 읽을때마다 조회수 증가 하게 하는 팁
2007.11.06 08:16
제로보드XE나 똑띠님 웹사이트 또는 Simulz님의 웹사이트 처럼 접속자가 많은 대형 웹사이트가 아닌 이상 접속한 IP 당 1개의
조회수 증가는 왠지 자신의 웹사이트에 있는 콘텐츠를 아무도 안읽는거 같은 기분을 느끼게 해줍니다 제가 운영하는 웹사이트
의 경우 하루 접속자가 많아봐야 100명 이 안되고 매번 들려주시는 분들이 접속하여 글을 읽습니다. 같은 아이피로 접속을 해서
글을 읽고 또 나중에 다시 와서 읽었던 글을 또 읽고 하거든요. 소규모 커뮤니티 웹사이트나 인트라넷으로 웹사이트를 돌리는
경우에도 좋은 콘텐츠가 있음에도 접속하는 IP가 제한되어 있기때문에 글 조회수가 안올라가면 왠지 아무도 내 글을 안보는 것
같은 기분을 들게해서 기분이 묘 할때가 많습니다. 위와 같이 느낌을 받는 분들은 아래의 방법대로 코드를 수정하시면 IP당 1개
의 조회수가 아닌 글을 읽을때마다 조회수가 증가 할수 있게 할수 있습니다.
알바트로스 적용후 다시 코드를 수정하였으므로 알바트로스 적용하신 분들만 아래와 같이 코드를 수정하시면 됩니다.
(물론 이전 버전으로 웹사이트 돌리시는 분들도 라인만 다를뿐 코드는 똑같기 때문에 적용해보시면 될껍니다. 혹시 모르니
항상 수정하시기 전에 파일을 백업해두세요)
수정 방법:
본인 웹사이트의 /zbxe/modules/document/ 에 있는 document.controller.php 파일을 열어보시면 314 번째 라인 부터 361 라인
까지 조회수 증가 코드가 시작됩니다.
아래와 같은 코드가 들어 있는데
/**
* @brief 해당 document의 조회수 증가
**/
function updateReadedCount($oDocument) {
$document_srl = $oDocument->document_srl;
$member_srl = $oDocument->get('member_srl');
$logged_info = Context::get('logged_info');
// session에 정보로 조회수를 증가하였다고 생각하면 패스
if($_SESSION['readed_document'][$document_srl]) return false;
// 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스
if($document->ipaddress == $_SERVER['REMOTE_ADDR']) {
$_SESSION['readed_document'][$document_srl] = true;
return false;
}
// document의 작성자가 회원일때 조사
if($member_srl) {
// 글쓴이와 현재 로그인 사용자의 정보가 일치하면 읽었다고 생각하고 세션 등록후 패스
if($member_srl && $logged_info->member_srl == $member_srl) {
$_SESSION['readed_document'][$document_srl] = true;
return false;
}
}
// 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단
if($logged_info->member_srl) {
$args->member_srl = $logged_info->member_srl;
} else {
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$args->document_srl = $document_srl;
$output = executeQuery('document.getDocumentReadedLogInfo', $args);
// 로그 정보에 조회 로그가 있으면 세션 등록후 패스
if($output->data->count) return $_SESSION['readed_document'][$document_srl] = true;
// 조회수 업데이트
$output = executeQuery('document.updateReadedCount', $args);
// 로그 남기기
$output = executeQuery('document.insertDocumentReadedLog', $args);
// 세션 정보에 남김
return $_SESSION['readed_document'][$document_srl] = true;
}
이를 삭제 하시고 아래의 코드를 넣으시고 저장 후에 서버에 올리시면 됩니다
/**
* @brief 해당 document의 조회수 증가
**/
function updateReadedCount($oDocument) {
$document_srl = $oDocument->document_srl;
$member_srl = $oDocument->get('member_srl');
$logged_info = Context::get('logged_info');
// session에 정보로 조회수를 증가하였다고 생각하면 패스
/*if($_SESSION['readed_document'][$document_srl]) return false;
// 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스
if($document->ipaddress == $_SERVER['REMOTE_ADDR']) {
$_SESSION['readed_document'][$document_srl] = true;
return false;
} */
// document의 작성자가 회원일때 조사
if($member_srl) {} /*
// 글쓴이와 현재 로그인 사용자의 정보가 일치하면 읽었다고 생각하고 세션 등록후 패스
if($member_srl && $logged_info->member_srl == $member_srl) {
$_SESSION['readed_document'][$document_srl] = true;
return false;
}
}*/
// 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단
if($logged_info->member_srl) {
$args->member_srl = $logged_info->member_srl;
} else {
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$args->document_srl = $document_srl;
$output = executeQuery('document.getDocumentReadedLogInfo', $args);
// 로그 정보에 조회 로그가 있으면 세션 등록후 패스
/* if($output->data->count) return $_SESSION['readed_document'][$document_srl] = true; */
// 조회수 업데이트
$output = executeQuery('document.updateReadedCount', $args);
// 로그 남기기
$output = executeQuery('document.insertDocumentReadedLog', $args);
// 세션 정보에 남김
return $_SESSION['readed_document'][$document_srl] = true;
}
쿨럭!
- [2015/06/02] 묻고답하기 링크게시판은 조회수가 안 올라가나요? *2
- [2014/07/16] 묻고답하기 스케치북5 게시판 목록에서 조회수 삭제하는 방법 *2
- [2011/04/25] 묻고답하기 전체조회수를 메인에 나타내는 방법이 없나요? *1
- [2009/08/15] 웹마스터 팁 게시글 조회수 바꾸기 *4
댓글 19
-
좋은 팁 감사합니다.
-
ckdans
2007.11.06 13:38
good!
thanks a lot~ -
박흥식546
2007.11.06 14:19
감사합니다.
홈페이지 접속자 수를 접속 할 때 마다 카운터가 올라 가게는 할 수 없는 지요 ?
저희 홈피 경우 같은 사람이 여러번 접속하게 되는데 하루 한번 만 카운터 되니...
회원 비회원이든 홈피 접속하면 카운터가 올라 갔으면 합니다. 도와주세요 ^^* -
포레버
2007.11.06 14:57
감사합니다. -
박흥식546
2007.11.06 16:29
Fatal error: Cannot redeclare documentController::updateReadedCount() in C:\KebiHome\imsilc\modules\document\document.controller.php on line 366
적용하니 위의 에러메시지 나오는데... -
박흥식546
2007.11.06 18:47
0.2.5 업데이트 후 잘 됩니다. 감사합니다.
방문자 카운터도 이와 같이 되었으면 좋겠습니다. 방법이 없나요 ^^* -
채진오
2007.11.07 11:56
좋은 정보 감사합니다. ^^
-
감사합니다. 저도 찾고있던 건데. 유용하게 사용할게요
-
도토리나무
2007.11.10 10:54
감사합니다. 저도 추천 한방 했습니다.^^ -
소우리
2007.11.13 14:15
추천
-
다이제초코
2007.11.13 17:43
Warning: Cannot modify header information - headers already sent by (output started at /home1/soo14/public_html/zbxe/modules/document/document.controller.php:1) in /home1/soo14/public_html/zbxe/classes/display/DisplayHandler.class.php on line 245
Warning: Cannot modify header information - headers already sent by (output started at /home1/soo14/public_html/zbxe/modules/document/document.controller.php:1) in /home1/soo14/public_html/zbxe/classes/display/DisplayHandler.class.php on line 246
Warning: Cannot modify header information - headers already sent by (output started at /home1/soo14/public_html/zbxe/modules/document/document.controller.php:1) in /home1/soo14/public_html/zbxe/classes/display/DisplayHandler.class.php on line 247
Warning: Cannot modify header information - headers already sent by (output started at /home1/soo14/public_html/zbxe/modules/document/document.controller.php:1) in /home1/soo14/public_html/zbxe/classes/display/DisplayHandler.class.php on line 248
Warning: Cannot modify header information - headers already sent by (output started at /home1/soo14/public_html/zbxe/modules/document/document.controller.php:1) in /home1/soo14/public_html/zbxe/classes/display/DisplayHandler.class.php on line 249
Warning: Cannot modify header information - headers already sent by (output started at /home1/soo14/public_html/zbxe/modules/document/document.controller.php:1) in /home1/soo14/public_html/zbxe/classes/display/DisplayHandler.class.php on line 250
Warning: Cannot modify header information - headers already sent by (output started at /home1/soo14/public_html/zbxe/modules/document/document.controller.php:1) in /home1/soo14/public_html/zbxe/classes/display/DisplayHandler.class.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home1/soo14/public_html/zbxe/modules/document/document.controller.php:1) in /home1/soo14/public_html/zbxe/classes/display/DisplayHandler.class.php on line 99
이건 무슨 오류인가요??? -
닉.네.임
2007.12.06 22:39
-
낙지298
2007.12.21 11:54
안녕 하세요 님팁 따라 할려니...
php 파일을 열어보시면 글자가 깨져 보이네요 어찌 해야 하나요. (zbxe 사용)/**
* @brief 愿由ъ옄 ?섏씠吏?먯꽌 ?좏깮??臾몄꽌????젣
**/
function procDocumentAdminDeleteChecked() {
// ?좏깮??湲???놁쑝硫??ㅻ쪟 ?쒖떆
$cart = Context::get('cart');
if(!$cart) return $this->stop('msg_cart_is_null');
$document_srl_list= explode('|@|', $cart);
$document_count = count($document_srl_list);
if(!$document_count) return $this->stop('msg_cart_is_null');// 湲??젣
$oDocumentController = &getController('document');
for($i=0;$i<$document_count;$i++) {
$document_srl = trim($document_srl_list[$i]);
if(!$document_srl) continue;$oDocumentController->deleteDocument($document_srl, true);
}$this->setMessage( sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) );
} -
비밀얌
2008.01.31 01:07
한글 원도우를 안쓰실 경우 note pad등으로 열면 한글이 깨져보입니다.
그럴경우 그냥 코드만 바꾸면 됩니다. -
kngkng
2007.12.26 11:17
edit plus 같은 툴을 사용하여 ftp로 open remote 열어서 수정하시면 편리합니다. 글자도 안꺠지고요.. -
빅브라더
2008.01.23 09:56
짝짝짝!!! 님하 킹왕짱! 정말 좋은 팁입니다. 감사드립니다.
-
히즈웨이
2008.02.13 02:52
Warning: Cannot modify header information - headers already sent by (output started at /homepages/20/d207436682/htdocs/v8/modules/document/document.controller.php:1) in /homepages/20/d207436682/htdocs/v8/classes/display/DisplayHandler.class.php on line 201
라는 에러메세지가 생깁니다. 해결하려면 어떻게 해야하는지? -
바루짱
2008.02.13 15:36
감사해요~ -
블루파티
2008.09.11 22:02
좋은 팁 감사합니다. 이 방식이 더 타당합니다. 조회수라고 했으면 조회수마다 올라가야죠. 조회수는 머리수가 아니니까...
제목 | 글쓴이 | 날짜 |
---|---|---|
UTF-8과 Euc-kr 동시에 사용하기 [10] | 써니a | 2007.11.05 |
아이디/비번 찾기 메일 깨지는 현상 해결 [3] | 짱돌의세상 | 2007.11.06 |
글을 읽을때마다 조회수 증가 하게 하는 팁 [19] | 비밀얌 | 2007.11.06 |
SVN 의 사용 방법 [3] | preware | 2007.11.06 |
완전 초보도 확장 변수를 이용해 게시판 개조할수잇다!! [4] | 쿤. | 2007.11.06 |
(08년 1월2일수정)0.2.3이후 최근글에 공지사항을 제외시키고자할 경우 [11] | 포레버 | 2007.11.07 |
제로보드4, xe 버전 바이러스에 대한 질문 [1] | 투자혁명 | 2009.04.15 |
제로보드 2.3 에서 2.5 변경사항 데이터 테이블 구조 변경사항 체크를 정리해봅니다. [4] | 도토리나무 | 2007.11.09 |
제로보드 2.3 에서 2.5 업그레이드 방법 | 도토리나무 | 2007.11.09 |
첨부파일 기능에 대한 짧은 정보 [3] | 고라리 | 2007.11.09 |
외부 문서에서 회원 정보 얻는 방법 [11] | 소마세월 | 2007.11.10 |
통합검색 버그 style 수정 [2] | 소마세월 | 2007.11.11 |
알바트로스 적용후 검색하는 곳에 댓글과 태그 검색 업션 넣기 [1] | 비밀얌 | 2007.11.13 |
[수정]업로드된 그림 자동출력 [6] | 소마세월 | 2007.11.13 |
이미지 갤러리 셀렉트박스 문제 [1] | 공작대천사 | 2007.11.14 |
<head> 태그안에 임의의 내용을 넣는 방법 [1] | 발돋움 | 2007.11.16 |
간편해진 페이지 수정법
![]() | coll | 2007.11.16 |
XP 환경에서의 속도 저하 문제 해결 (Apache 2.2.X) [2] | Netsblue | 2007.11.20 |
분류(category) 필수로 입력받기 [9] | Diver | 2007.11.20 |
제한된 서버에서 ZBXE가 돌아가도록 설정하기 [2] | Falls Too Fast | 2007.11.22 |