<script src="/js/web/swiper.min.js"></script>
<link rel="stylesheet" href="/js/web/swiper.min.css">


    <div class="channel_contents3" style="min-height:600px">
		<div class="wrap">
			<div class="channel_top" style="text-align:center;">
                <button type="button" class="btn btn-default br20" onclick="location.href='/web/life/channel_recommend'" style="padding:10px 40px;font-size: 19px; font-weight: 200 !important;">추천채널 </button>
                <button type="button" class="btn btn-default_bb br20" onclick="location.href='/web/life/category'" style="padding:10px 40px;font-size: 19px; font-weight: 200 !important;">카테고리 </button>
        	</div>
            <div class="channel_category bgb3">
                 <div class="swiper-container">
                    <div class="swiper-wrapper" style="padding-bottom: 10px;">
                <?  foreach ($arr_category as $key=>$val) {
                        $category_name_txt = mb_strimwidth($val['category_name'], '0', '10', '..', 'utf-8');
                ?>
                        <div class="swiper-slide"><a href="/web/life/category/<?=$val['idx']?>" <? if($category_idx==$val['idx']) { echo 'class="current"';}?>><?=$category_name_txt?></a></div>
                <?  }?>
                    </div>
                </div>
            </div>

			<div class="channel_tit">
				<?=$category_name?> <span class="beachblue"><?=number_format($total_count)?></span>
				<span class="fr art_bt" style="margin-top:-5px;">
                    <button type="button" onclick="location.href='/web/life/category/<?=$category_idx?>?search_sort=1'" class="btn <? if($search_sort=='1') { echo 'btn-default_bb'; } else { echo 'btn-default';}?> br20" >최신순</button>
					<button type="button" onclick="location.href='/web/life/category/<?=$category_idx?>?search_sort=2'" class="btn <? if($search_sort=='2') { echo 'btn-default_bb'; } else { echo 'btn-default';}?> br20">인기순</button>
				</span>
			</div>


			<div id="editor_list">

       <?   $i=1;
            $editor_count = count($list);
            if($editor_count == 0) echo '<div style="height:100px; text-align:center; padding-top:30px">등록된 에디터가 없습니다.</div>';
            foreach ($list as $val) {
                if($i%4==1) echo '<div class="channel_boxs">';


           ?>
                <div class="bk_con" onclick="location.href='/web/life/editor/<?=$val['idx']?>'" style="cursor: pointer">
					<span class="shadow"></span>
                    <div class="art-img" onclick="location.href='/web/life/editor/<?=$val['idx']?>'" style="border-radius: 5px;cursor:pointer;width:173px;height:246px;background:url('<?=$val['main_img']?>') no-repeat center; background-size:cover;"></div>
					<p class="chn_tit"><a href="/web/life/editor/<?=$val['idx']?>"><?=$val['partner_name']?></a></p>
					<p class="chn_bar"> <img src="/img/web/bg_bar.gif"></p>
					<p class="chn_reply"><span class="beachblue" style="font-size:18px;"><a href="/web/life/editor/<?=$val['idx']?>"><?=number_format($val['article_count'])?></a></span><span style="font-size:14px;"> 개 글</span></p>
				</div>


       <?

                if($i%4==0 || $editor_count==$i)    echo '</div>';

                $i++;
            }

            $more_btn_style = 'style="display:none"';
            if($editor_count < $total_count) {
                $more_btn_style = 'style="display:block"';
            }
        ?>


			</div>

			<div class="channel_bottom2" <?=$more_btn_style?> id="editor_more_btn">
				<button type="button" class="btn btn-default br20" onclick="category_list_more();" style="width: 110px;height: 35px;">더보기 </button>
			</div>
		</div>
	</div>

<script>
var swiper = new Swiper('.swiper-container', {
	slidesPerView: 7,
	spaceBetween: 0,
	initialSlide: "<?=$swiper_page?>"
});


var page = 2;
function category_list_more(){
	var form_data = {
		"sort"					: "<?=$search_sort?>",
		"page"					: page,
		"category_idx"			: "<?=$category_idx?>"
	};
	$.ajax({
        url: '/web/life/editor_list_more',
        async: false,
        type: 'POST',
        dataType: 'HTML',
        data: form_data,
        success: function (rtnHtml) {
        	if(rtnHtml=='') return false;
			var arrHtml = rtnHtml.split("|||||");
			if(arrHtml[0].trim()=='0000') {
				$("#editor_list").append(arrHtml[1]);
				if (arrHtml[3] == "N") {
					$("#editor_more_btn").hide();
				} else {
					$("#editor_more_btn").show();
				}
				page++;

			} else {
				alert(arrHtml[1]);
               	return false;
			}
        },
        error: function (rtnHtml) {
            alert('리스트 가져오기에 실패했습니다.');
            return false;
        }
    });
}




</script>
