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


<?echo trim($swiper_page);?>
<?
$page_title = "추천카테고리";
$page_title_link = '#';
require_once(APPPATH."/views/m/common/light_header.php");?>
<div class="channel_cont channel_cont_fixed">
	<div class="wrap">
		<div class="channel_top" style="text-align:center; margin-bottom:0 !important;">
			<button type="button"  onclick="location.href='/m/life/channel_recommend'" class="btn btn-default br10" style="padding:7px 30px;font-size: 19px; font-weight: 200 !important;">추천채널 </button>
			<button type="button"  onclick="location.href='/m/life/category'" class="btn btn-default_bb br10" style="padding:7px 30px;font-size: 19px; font-weight: 200 !important; margin-left:10px;">카테고리 </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
								style = "    font-weight: bold;font-size:15px;"
								href="/m/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>
			<ul class="fr life_click2">
				<li><a style="cursor:pointer" onclick="location.href='/m/life/category/<?=$category_idx?>?search_sort=1'" <?=($search_sort=='1')? 'class="current"':''?>>최신순</a></li>
				<li>|</li>
				<li><a style="cursor:pointer" onclick="location.href='/m/life/category/<?=$category_idx?>?search_sort=2'" <?=($search_sort=='2')? 'class="current"':''?>>인기순</a></li>
			</ul>
		</div>

		<?   $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 $i=>$val) {
			if($i%2==0) echo '<div class="channel_boxs">';


			?>
			<div class="bk_con"  onclick="location.href='/m/life/editor/<?=$val['idx']?>'" >
				<span class="shadow" style="cursor:pointer"></span>
				<a ><img style="cursor:pointer" src="<?=$val['main_img']?>" class="art-img"></a>
				<p class="chn_tit"><a href="/m/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="/m/life/editor/<?=$val['idx']?>"><?=number_format($val['article_count'])?></a></span><span style="font-size:14px;"> 개 글</span></p>
			</div>


			<?

			if($i%2==1 || $editor_count==($i+1))    echo '</div>';

		}

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



		<p style="text-align:center;">
			<button type="button" onclick="category_list_more();" class="btn btn-default br20" style="padding:8px 40px; font-size:16px;">더보기 <img src="/img/mobile/arr_down.gif" style="vertical-align:middle;">
			</button>

		</p>
	</div>
</div>




<script>
var swiper = new Swiper('.swiper-container', {
	slidesPerView: 4,
	spaceBetween: 0,
	initialSlide: 0
});


var page = 2;
function category_list_more(){
	var form_data = {
		"sort"					: "<?=$search_sort?>",
		"page"					: page,
		"category_idx"			: "<?=$category_idx?>"
	};
	$.ajax({
        url: '/m/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>
