묻고답하기

게시판의 리스트 화면에서  정렬기준(확장변수 복수의 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 남기남
카이4525b 서버 이전... 총체적 난국입니다...ㅠㅠ [2] 2018.01.08 by 카이4525b
rail_man 섬네일 이미지가 일정하게 나타나지 않습니다. [4] 2018.01.08 by rail_man
타이레놀 메인화면에 최근게시물 안나오게 하는 방법이요 [1] 2018.01.08 by Ansi™
화랑529 사이트 이전했는데.. 왜 이런게 뜨나요 ??  
곰북이 로그인 오류  
waydo php 5.3에서만 작동합니다. [1] 2018.01.07 by waydo
유샤인 ver 1.9.2로 새로 만든 XE에 로그인 시에 이런 에러 메세지가 뜹니다.  
쮸야282 폰에서는 로그인인 되는데 웹에서는 안되네요. [1] file 2018.01.06 by 휘즈
11111a901f 팝업창 띄우는 방법 [1] 2018.01.06 by 휘즈
땁쓰 최신글 위젯에 최신글 노출이 않됩니다. [3] 2018.01.06 by DoorWeb
홈런볼11 자신이 작성한 게시물일 경우를 함수로 하면? [4] 2018.01.06 by 홈런볼11
바람처럼 한글테이블 명, 한글 필드명 사용 문제점  
이진수닷넷 게시판 분류관리, 먹통 [1] file 2018.01.05 by 파이팅건맨
ah Parse error  
rail_man 게시판 글꼴 크기를 좀더 세분화 할수는 없는지요????  
컴박살 카카오 로그인후 로그아웃을 어떻게 해야 할찌 ㅡ.ㅡ; [3] 2018.01.05 by 혁이
원샷 xe로 부트스트랩적용을 어떻게하나요..? [4] 2018.01.04 by 원샷
황금벌레 php 4.4.4 에서 확~ 업그레이드 하고 싶은데요. [1] 2018.01.04 by 황금벌레
서정민 네이버 로그인 연동 [11] 2018.01.04 by 아찌
아찌 네이버 로그인연동 질문 드립니다. file  
Jey Xedition does not work. Could you suggest a solution? [1] file 2018.01.04 by XE
잡순이 위젯페이지 모바일 CSS 어디서 수정해야되나요? [2] file 2018.01.04 by 잡순이
54o66352 포인트 초기화 이후 계속적으로 초기화됩니다.  
지나김 페이지(위젯) 무제한 생성 안되는 문제, 도움 주십시요. [1] 2018.01.03 by SimpleCode
달구벌 게시판제목 글자크기를 크게할수 없나요? [3] 2018.01.04 by 달구벌
카이4525b Php 5.2.11에 설치 가능 한 코어는 몇 버전 인가요? [2] 2018.01.03 by 카이4525b
o**** 레이아웃이 적용이 안되요 ㅠㅠ [1] file 2018.01.03 by 이근동
램램 XE에 문제가 생겼습니다. [1] 2018.01.03 by sejin7940
예진JEvans 게시물과 코멘트만 따로 백업하는 방법은 없나요? [1] 2018.01.03 by 디자인클립
Giant Search Result [1] 2018.10.19 by doorscope@yahoo.com