일정 추천 수 이상의 게시글만 목록에 불러오기
타임라인 같은 추가모듈이나 기타 애드온, 게시글 이동 없이 일정 추천 수 이상의 게시글만 목록에 불러오는 방법입니다.
디시인사이드의 개념글 시스템 혹은 해연갤(https://hygall.com/index.php?mid=hy&best=10 )의 개념글 시스템과 비슷한 개념으로 보시면 됩니다.
modules/board/board.view.php
523
524
525
526
527
528
|
{
$args->category_srl = Context::get('category');
}
// setup the sort index and order index
$args->sort_index = Context::get('sort_index');
$args->order_type = Context::get('order_type');
|
cs |
바로 아래줄에 추가합니다.
523
524
525
526
527
|
if($args->sort_index=='recommend')
{
$args->search_target = 'voted_count';
$args->search_keyword = 5;
}
|
cs |
이렇게 하면 게시판 주소 뒤에 ?sort_index=recommend와 같은 파라미터를 붙일 시 추천 수가 5개 이상인 게시글만 출력됩니다.
아래와 같이 추천 수 숫자를 직접 입력받는 방식으로 응용할 수도 있습니다. (?recommend=숫자)
523
524
525
526
527
|
if(Context::get('recommend'))
{
$args->search_target = 'voted_count';
$args->search_keyword = abs(Context::get('recommend'));
}
|
cs |
댓글 4
유용하게 쓸 수 있는 팁이네요!
코어의 통합게시판 기능이랑 연동까지 해서 애드온으로 구현한다면 훨씬 더 멋있을 것 같습니다.
이렇게 쓰신다면 유지보수상으로 어렵고 타임라인모듈과 활용되는 @웹스택 님의 자료를 이용하시면 저런 비슷한 방식으로 구현이 가능한 것 같더군요.
https://xetown.com/updatenews/1539402