메뉴 건너뛰기

XE : Xpress Engine


XE에 대한 생각! XE에 대한 공감! - XE를 사용하는 다른 사람들과 의견을 나눌 수 있는 곳입니다. 많은 의견 공유로 더 좋은 XE를 만들어 주세요.


XE 사용팁

이전글, 다음글 얻기

2008.05.29 19:17

[레벨:19]라르게덴 조회 수:6521 추천:4

질문&답변 란에 글이 좀 보이길래 한번 만들어봤습니다. (저도 써야하기 땜시롱)

이걸 애드온으로 해둘까하다가 그냥 입맛에 맞게 하시라고 소스만 드릴게요.
function getDocumentDivision($document_srl,$type,$order){
            $oDocumentModel = &getModel('document');
            $oDocument = $oDocumentModel->getDocument($document_srl, '');
    
                $args->module_srl = $oDocument->get('module_srl');

                if($order == 'list_order') {
                    $args->list_order = $oDocument->get('list_order');
                    $args->sort_index = 'list_order';
                } elseif($order == 'update_order') {
                    $args->update_order = $oDocument->get('update_order');
                    $args->sort_index = 'update_order';
                }
                if($type == 'next')    $args->order_type = 'desc';
                elseif($type == 'prev')    $args->order_type = 'asc';

                $args->list_count = 1;
                $args->page_count = 1;
                $args->page = 1;

                if($type == 'next') $output = executeQuery("document.getNextDivision", $args);
                elseif($type == 'prev')  $output = executeQuery("document.getPrevDivision", $args);

                if($output->data) {
                    $data = array_pop($output->data);
                    $division_document = $data->document_srl;
                }

            return $division_document;
        }


getNextDivision.xml
<query id="getNextDivision" action="select">
    <tables>
        <table name="documents" />
    </tables>
    <columns>
        <column name="*" />
    </columns>
    <conditions>
        <condition operation="in" column="module_srl" var="module_srl" filter="number" />
        <condition operation="below" column="list_order" var="list_order" filter="number" pipe="and" />
        <condition operation="below" column="update_order" var="update_order" filter="number" pipe="and" />
    </conditions>
    <navigation>
        <index var="sort_index" default="list_order" order="order_type" />
        <list_count var="list_count" default="1" />
        <page_count var="page_count" default="1" />
        <page var="page" default="1" />
    </navigation>
</query>

getPrevDivision.xml
<query id="getPrevDivision" action="select">
    <tables>
        <table name="documents" />
    </tables>
    <columns>
        <column name="*" />
    </columns>
    <conditions>
        <condition operation="in" column="module_srl" var="module_srl" filter="number" />
        <condition operation="excess" column="list_order" var="list_order" filter="number" pipe="and" />
        <condition operation="excess" column="update_order" var="update_order" filter="number" pipe="and" />
    </conditions>
    <navigation>
        <index var="sort_index" default="list_order" order="order_type" />
        <list_count var="list_count" default="1" />
        <page_count var="page_count" default="1" />
        <page var="page" default="1" />
    </navigation>
</query>


스킨 같은 곳에서 사용 방법
{@$oDivision = &getModel('document')}
다음글 {$oDivision->getDocumentDivision($oDocument->document_srl,'next','list_order')}
이전글 {$oDivision->getDocumentDivision($oDocument->document_srl,'prev','list_order')}

list_order로 정렬 법과 update_order로 정렬 법으로 되게 해봤습니다.

executeQuery("document.getNextDivision", $args);
document 은 xml 파일이 있는 곳으로 바꿔주셔야 합니다.

xml파일을 addons/애드온명/queries/ 폴더에 넣어서 사용하실 경우는 addons.애드온명.getNextDivision 으로 되어야 겠죠.

그리고 만약 addons/애드온명 폴더 안에서 사용할 경우라면

다음글 {getDocumentDivision($oDocument->document_srl,'next','list_order')}
이전글 {getDocumentDivision($oDocument->document_srl,'prev','list_order')}

이런식으로 사용하세요.


---------------------

추가 설명 해드립니다.

제일 위의 소스파일은 제로XE/modules/document/document.model.php 의 제일 하단

        /**
         * @brief 문서 설정 정보를 구함
         **/
        function getDocumentConfig() {
            if(!$GLOBLAS['__document_config__'])  {
                $oModuleModel = &getModel('module');
                $config = $oModuleModel->getModuleConfig('document');

                if(!$config->thumbnail_type) $config->thumbnail_type = 'crop'+ '+ ';
                $GLOBLAS['__document_config__'] = $config;
            }

            return $GLOBLAS['__document_config__'];
        }


---- 요기 붙여넣기 해주세요 ----      

    }
?>

나머지 xml의 내용은 제목대로(getNextDivision.xml,getPrevDivision.xml) 각각 파일로 만드셔서

제로XE/modules/document/queries/ 폴더에 넣어주세요.



주의1. 꼭 파일 저장하실때(특히 XML) UTF-8로 저장하세요.
주의2. 안되면?? ㄷㄷㄷ;;;; 저는 됐습니다. 안되면 어쩔수 없이 물어보세요 ^^
번호 제목 글쓴이 날짜 조회 수
공지 질문은 묻고 답하기로~ TSCMD 2012.02.03 10406
494 외부문서에서 mms:// 태그 사용하기 [10] [레벨:2]아고라 2009.06.12 1552
493 게시판 스킨에서 조회수, 추천수, 최근 수정일 외 항목도 정렬가능하게 하기 [레벨:30]SMaker 2009.06.11 1493
492 최근 이미지 출력 위젯에서 글 제목 출력을 선택항목으로 바꾸기 [6] [레벨:6]必得力 2007.10.17 37060
491 묻고 답하기용 게시판 [1] [레벨:1]yunesb 2009.01.24 1302
490 음악판매 [5] [레벨:1]물푸레646 2008.12.27 3780
489 서브 메뉴 배경색 바꾸기 [4] file [레벨:4]Chang-Jo(창조) 2007.08.17 7810
488 BGM 가로스크롤바 없애는 방법.. [레벨:2]청개굴이 2009.06.03 1450
487 글쓴이 이메일 정보 감추기 [2] [레벨:12]대암지기 2007.11.22 1424
486 Firebug와 FirePHP를 통한 XpressEngine의 디버깅 [3] file [레벨:4]mooo 2009.04.01 1737
485 BGM 쓰시는분 게시판 에서 첨부파일 다운받을때 끊어지시죠?ㅎㅎ [4] [레벨:11]우리아기 2009.05.23 1319
484 스프링노트 연동문제 [2] [레벨:1]nonoboy 2009.05.21 1303
483 별도 페이지 로그인방법 [레벨:2]cornet 2009.05.21 1603
482 까페 아이디 삭제후 동일 아이디로 생성하는 방법 [레벨:3]키스메리 2009.05.15 3826
481 winxp IE7 rwapm에서 한글이름파일 업로드 [12] [레벨:2]공수래 2007.09.17 19381
480 페이지 및 게시판 메뉴 경로 [2] file [레벨:1]자반튀김 2009.04.15 4904
» 이전글, 다음글 얻기 [24] [레벨:19]라르게덴 2008.05.29 6521
478 1.2.2 업데이트 이후 위젯이 출력안되시는 분들 [1] [1] [레벨:5]반도체맨 2009.05.01 1340
477 BNU님의 Planner XE 1.2 버젼(일정관리) [10] file [레벨:6]개돌 2009.04.21 5122
476 [질문]회원가입시 음력생일입력 가능 한가요? [1] [레벨:1]신정 2009.04.27 3942
475 주민등록번호 입력 폼 추가 (1.1.5 기준) [39] [레벨:6]개돌 2009.02.16 5717