묻고답하기

게시판의 리스트 화면에서  정렬기준(확장변수 복수의 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 남기남
레드토네이도 코인위젯이나 제작 가능하신분  
whiterose5889 SOS...모바일에서 사진이 본문에 삽입되지 않음...... [1] file 2017.12.23 by 카이4525b
카이4525b 회원정보 수정금지 적용 질문 [2] file 2017.12.23 by 카이4525b
SpeaC 특정 글의 확장변수 값을 다른곳에 뿌려주려면.. [4] 2017.12.22 by sejin7940
친구제본79JEBONKR 글쓰기 금지 문구  
Exodus 게시판의 글씨와 설정메뉴 [1] file 2017.12.22 by HowtoXE
크리스마스성형외과 게시판 srl 값은 어떻게 확인할 수 있나요? [1] file 2017.12.22 by sejin7940
파파베어 게시판 관리에서 바로가기?주소가 이상해요 [4] file 2017.12.22 by 파파베어
파파베어 유튜브 영상 다운로드버튼 만들수가 있나요?  
씽씽씽 처음 접속할 때 나눔고딕 설치하라는 메세지 [1] file 2017.12.21 by HowtoXE
개tothe미 파일 전체 다운로드 [1] 2017.12.21 by HowtoXE
godsmile xe data export tool ver 0.4 이전툴을 사용중 에러가 발생했습니다 [1] file 2017.12.21 by HowtoXE
Lala 댓글 접기 가능할까요? [1] 2017.12.21 by HowtoXE
whiterose5889 SKETCHBOOK5 스킨으로 모바일 설정없이 모바일에서 사진 본문에 삽입 방법은 없나요?  
rkskek**** 웹툰형식 질문입니다 [1] 2017.12.20 by Ansi™
thdwjdtjr 나눔고딕을 사용중인 서버에 올려놓고 불러와 사용 [3] 2017.12.20 by Ansi™
열혈남아 [재]메인이미지에 링크를 걸려면 어떻하나요?? 꼭 좀 도와주세요!! [4] 2017.12.19 by 열혈남아
열혈남아 메인이미지에 링크를 걸려면 어떻하나요?? 꼭 좀 도와주세요!! [6] 2017.12.19 by 열혈남아
야누 게시판에 올린 사진을 백업하는 방법이 있나요? [3] 2017.12.19 by 휘즈
이원호 content 위젯 탭 링크 주소를 바꾸고 싶습니다 [1] 2017.12.19 by 재미나게
dk 게시판 태그 검색 후 이동 문제 [2] 2017.12.19 by dk
outsider 시놀로지 XE 설치시 DB 연결 실패 [4] file 2017.12.19 by 명이
희왕자 이미지맵 스마트폰에서만 다른페이지 링크가 되네요... [2] file 2017.12.18 by 희왕자
Espressomachine 메모게시판 포인트 오류  
마듀 쪽지 발송은 되는데 확인하면 잘못된 요청이라고 뜨네요ㅠㅠ  
마듀 로그인할때 기본URL 설정이 안되어있다고 뜹니다 [2] 2017.12.17 by 마듀
모몽 사용자 정의 항목에서 형식을 마음대로 만들 수 없을까요?? [2] 2017.12.17 by 모몽
김민석56bb1 infinityfree 로 xe를 어떻게 설치 합니까?  
ybc 아이폰에서 접속 불가  
koll**** xml 조인 및 서브 쿼리 질문드립니다.. [1] 2017.12.15 by SimpleCode