묻고답하기

게시판의 리스트 화면에서  정렬기준(확장변수 복수의 order by) 추가 하는 방법이 있나요?

 

no edit.png

 

 

위와 같이 홈페이지를 구축해서 사용중 입니다. 확장변수로 값을 입력받아서 엑셀로 출력하는 홈페이지 입니다.

그런데 위의 빨간 테두리에 있는 것 처럼 "게시판 설정" 에 보면 정렬기준이 하나 밖에 없습니다.

 

default_setting_board_sort.png

 

 

확장변수의 근무일자를 선택해서 내림차순으로 정렬되게 했는데요. 문제는 오른쪽에 시작 시간이 09:00 시가 내림차순으로 똑같이 적용이 되어서 정렬이 되야 합니다 붉은 09:00 가 아래의 20:00 밑으로 정렬이 되야 하는데 현재 XE 게시판 설정화면에는 정렬이 하나만 선택이되도록 되어 있어서 처리가 안됩니다.

 

혹시 방법을 아시는 분이 계시나요? 게시판 list.html 파일의 상단에 강제로 정렬시키는 방법은 사용해 봤는데 게시글 검색을 하면 정상적으로 나오지를 않습니다. 이 방법이 아닌 방법을 찾고 있습니다.

 

================================================================================

 

위 처럼 제가 질문을 올렸었습니다. 답변이 없어서 몇일 어설픈 프로그래밍 실력으로 이것 저것 해보다가 자체적으로 해결했습니다.

그냥 저 정렬방법을 5순위까지 적용가능하게 처리 했더니 되기는 하는데 제대로 한건지는 모르겠습니다.

현재 해당 기능이 되도록 처리 하고 서버 재시작 후 정상적으로 동작하고 있습니다.

아래의 화면처럼 만들어서 현재 잘 사용하고 있습니다.

 

board_sort_type.png

 

정렬순서가 뒤죽 박죽 중간 중간 건너 띄어도 차례대로 선택된것들로만 1순위 2순위 3순위 식으로 정렬처리 되도록 했습니다.

그리고 나서 게시판으로 이동을 하니 아래와 같이 정렬이 정상적으로 되고 있습니다.

 

board_list_order_extra_sort.png

 

modules / document / document.model.php

modules / board / board.view.php

modules / board / board.admin.controller.php

modules / board / board.admin.view.php

modules / board / tpl / board_insert.html

 

그리고 각각 순위별 쿼리를 위해서 확장변수 정렬을 담당하는 xml 파일

modules / board / queries / getDocumentListExtraSort.xml (기본정렬, 1순위 정렬용)

modules / board / queries / getDocumentListExtraSort2.xml (2순위 정렬용)

modules / board / queries / getDocumentListExtraSort3.xml (3순위 정렬용)

modules / board / queries / getDocumentListExtraSort4.xml (4순위 정렬용)

modules / board / queries / getDocumentListExtraSort5.xml (5순위 정렬용)

 

파일을 따로 만들어서 저장 후 해당 php 파일에서 $query_id를 각각 지정되서 처리 되도록 수정했습니다.

 

그리고 하단 검색을 했을 때에도 정렬이 똑같이 되서 보이도록

modules / board / queries / getDocumentListWithinExtraVarsExtraSort.xml

modules / board / queries / getDocumentListWithinExtraVarsExtraSort2.xml

modules / board / queries / getDocumentListWithinExtraVarsExtraSort3.xml

modules / board / queries / getDocumentListWithinExtraVarsExtraSort4.xml

modules / board / queries / getDocumentListWithinExtraVarsExtraSort5.xml

 

식으로 따로 따로 만들어서 똑같은 방법으로 처리 했습니다.

 

board.view.php 에서 sort_index 값을 sort_index2, sort_index3, sort_index4, sort_index5 식으로 받도록 하고

정렬 방법도 desc, asc 값도 나눠서 order_type~5 까지 받아서 처리하게 설정 후 각각의 sort_index 구간을 php에서 찾아서 나머지 sort_index2~5 및 order_type2~5를 추가하고 쿼리 아이디도 각각 지정되게 한 후 처음에 확인하니 무한로딩이 걸렸습니다.

 

서버 재시작 후 에는 정상적으로 작동이 되었습니다.

제일 힘들었던 것이 xml 파일 이해하는 것이 었습니다. 아직도 이해는 못하고 어떻게 처리 하면 되는지 감으로 한것이라...

 

아무튼 직접 삽질 후 처리 했습니다. ㅠㅠ

 

xml 파일 중 확장변수 정렬 관련 getDocumentListExtraSort5.xml 파일은 안에 내용을 아래와 같이 했습니다.

굵게 색깔이 처리된 부분이 추가한 부분입니다. 쿼리 아이디도 파일명에 맞게 수정했구요...

 

<query id="getDocumentListExtraSort5" action="select">
    <tables>
        <table name="documents" alias="d" />
        <table name="document_extra_vars" alias="ev" />
        <table name="document_extra_vars" alias="ev2" />
        <table name="document_extra_vars" alias="ev3" />
        <table name="document_extra_vars" alias="ev4" />
        <table name="document_extra_vars" alias="ev5" />

    </tables>
    <columns>
        <column name="d.*" />
    </columns>
 <index_hint name="idx_document_list_order" type="use" />
    <conditions>
        <condition operation="equal" column="ev.eid" var="sort_index" />
        <condition operation="equal" column="ev.document_srl" default="d.document_srl" pipe="and" />
        <condition operation="in" column="d.module_srl" var="module_srl" filter="number" pipe="and" />
        <condition operation="notin" column="d.module_srl" var="exclude_module_srl" filter="number" pipe="and" />
        <condition operation="in" column="d.category_srl" var="category_srl" pipe="and" />
        <condition operation="equal" column="d.is_notice" var="s_is_notice" pipe="and" />
        <condition operation="equal" column="d.member_srl" var="member_srl" filter="number" pipe="and" />
        <condition operation="in" column="d.status" var="statusList" pipe="and" />
        <group pipe="and">
            <condition operation="more" column="d.list_order" var="division" pipe="and" />
            <condition operation="below" column="d.list_order" var="last_division" pipe="and" />
        </group>
        <group pipe="and">
            <condition operation="like" column="d.title" var="s_title" />
            <condition operation="like" column="d.content" var="s_content" pipe="or" />
            <condition operation="like" column="d.user_name" var="s_user_name" pipe="or" />
            <condition operation="like" column="d.user_id" var="s_user_id" pipe="or" />
            <condition operation="like" column="d.nick_name" var="s_nick_name" pipe="or" />
            <condition operation="like" column="d.email_address" var="s_email_address" pipe="or" />
            <condition operation="like" column="d.homepage" var="s_homepage" pipe="or" />
            <condition operation="like" column="d.tags" var="s_tags" pipe="or" />
            <condition operation="equal" column="d.is_secret" var="s_is_secret" pipe="or" />
            <condition operation="equal" column="d.member_srl" var="s_member_srl" pipe="or" />
            <condition operation="more" column="d.readed_count" var="s_readed_count" pipe="or" />
            <condition operation="more" column="d.voted_count" var="s_voted_count" pipe="or" />
            <condition operation="less" column="d.blamed_count" var="s_blamed_count" pipe="or" />
            <condition operation="more" column="d.comment_count" var="s_comment_count" pipe="or" />
            <condition operation="more" column="d.trackback_count" var="s_trackback_count" pipe="or" />
            <condition operation="more" column="d.uploaded_count" var="s_uploaded_count" pipe="or" />
            <condition operation="like_prefix" column="d.regdate" var="s_regdate" pipe="or" />
            <condition operation="like_prefix" column="d.last_update" var="s_last_update" pipe="or" />
            <condition operation="like_prefix" column="d.ipaddress" var="s_ipaddress" pipe="or" />
        </group>
        <group pipe="and">
            <condition operation="more" column="d.last_update" var="start_date" pipe="and" />
            <condition operation="less" column="d.last_update" var="end_date" pipe="and" />
        </group>
        <group pipe="and">
         <condition operation="equal" column="ev2.eid" var="sort_index2" pipe="and" />
   <condition operation="equal" column="ev2.document_srl" default="d.document_srl" pipe="and" />
         <condition operation="equal" column="ev3.eid" var="sort_index3" pipe="and" />
   <condition operation="equal" column="ev3.document_srl" default="d.document_srl" pipe="and" />
         <condition operation="equal" column="ev4.eid" var="sort_index4" pipe="and" />
   <condition operation="equal" column="ev4.document_srl" default="d.document_srl" pipe="and" />
         <condition operation="equal" column="ev5.eid" var="sort_index5" pipe="and" />
   <condition operation="equal" column="ev5.document_srl" default="d.document_srl" pipe="and" />
        </group>

    </conditions>
    <navigation>
        <index var="ev.value" default="ev.value" order="order_type" />
        <index var="ev2.value" default="ev2.value" order="order_type2" />
        <index var="ev3.value" default="ev3.value" order="order_type3" />
        <index var="ev4.value" default="ev4.value" order="order_type4" />
        <index var="ev5.value" default="ev5.value" order="order_type5" />

        <list_count var="list_count" default="20" />
        <page_count var="page_count" default="10" />
        <page var="page" default="1" />
    </navigation>
</query>
 

 

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
숲속오솔길 xe1.9.6 [1] 2018.03.08 by 휘즈
무한잉크 .htaccess [2] file 2018.03.08 by veplay2
생크림 모바일 레이아웃 배경색상 수정방법 [2] 2018.03.08 by veplay2
kangng 회원정보수정란 없어짐 [1] file 2018.03.08 by sejin7940
보람차게 로그인이 계속 풀립니다 ㅜㅜ [1] 2018.03.08 by sejin7940
버들이291 문의드려요 [1] 2018.03.08 by sejin7940
토빈이 첨부파일 다운로드시 권한문제 [1] 2018.03.08 by sejin7940
김기정746 혹시 가능할지 문의 드립니다 ( 확장변수를 다른 게시판에 원클릭 가져오기)  
sji 페이지 수정을 했는데 페이지 자체가 보이지 않습니다.  
뿌직이 서버 이전 받은 XE가 이상합니다. (캐쉬 재생성 안됨 ->files폴더권한 변경 ->설치화면 뜸)  
구름의저편 스팸필터(키워드)가 작동을 안합니다. [2] 2018.03.08 by 똑디
똑디 스팸필터가 기능작동을 안하네요. [3] file 2018.03.08 by 똑디
ㅇㅇ465a1 특정 스킨에서 카테고리 분류가 선택이 안되요... [2] 2018.03.08 by ㅇㅇ465a1
백인흑인황인 board.controller 파일 이메일 폼 수정에 관하여 [2] 2018.03.08 by 백인흑인황인
리맹 웹콘의 최신글위젯을 인기게시글 위젯으로 개조하려고했는데 잘 안됩니다.  
T1000 스케치북 게시판 갤러리 게시판으로 사용시 섬네일 선정기준 [2] 2018.03.07 by T1000
보람차게 모바일 페이지에서 링크를 클릭시 피시 버전으로 넘어가집니다. [2] 2018.03.07 by 보람차게
MCFR html 홈페이지 작성중 이미지 표기 오류가 생깁니다. [2] 2018.03.07 by MCFR
윤안젤로 1.9.0 업데이트 후 게시판 분류에러 [11] file 2018.03.07 by 파이팅건맨
막시앤 profile_image 경로가 안보여요 완전 이상해요~  
꽁꽁 스케치북을 게시판으로 사용하고 있습니다. 아이콘 보기 [1] file 2018.03.06 by sejin7940
코만 관리자비밀번호분실시 [2] 2018.03.06 by sejin7940
홍땍땍 1.9.4 업데이트 후 홈페이지 자체 접속이 안됩니다. [2] 2018.05.08 by sejin7940
제인해일 게시판 글쓰기후 error 문제 [1] file 2018.03.06 by pmacsoft
방랑자유 스케치북5 스타일 최신글 위젯스킨 1.1 버전 문의  
브로콜링 섬네일이 생성되지 않습니다. [1] file 2018.03.05 by 브로콜링
eunhe**** ssh 접속이 안되요. [1] file 2018.03.04 by 기진곰
제자사랑 모바일 홈 화면 이미지를 어떻게 바꿀 수 있나요? file  
ppumweb sejin7940_write_limit 댓글수 제한 애드온 수정 [1] 2018.03.03 by 불금
혜연... 관리자 로그인 에러 file