<?php
$arr_search_keyword = array();
if($search_keyword!=''){
	$arr_search_keyword = explode(" ", $search_keyword);
}

?>
<? require_once(APPPATH."views/m/search/search_header.php"); ?>


<? 	if($total_count == 0) { ?>
	<div class="news_nothing">
		<div class="t_nothing"><span class="beachblue"><?=$search_keyword?></span> 에 대한 검색결과가 없습니다.</div>
		<ul>
			<li>단어의 철자가 정확한지 확인해 보세요.</li>
			<li>한글을 영어로 혹은 영어를 한글로 입력했는지 확인해보세요.</li>
			<li>검색어의 단어 수를 줄이거나, 보다 일반적인 검색어로 다시 검색해보세요.</li>
			<li>두 단어 이상의 검색어인 경우, 띄어쓰기를 확인해 보세요.</li>
			<li>검색 옵션을 변경해서 다시 검색해 보세요.</li>
		</ul>
	</div>


<? 	} ?>

<div class="news_cont2">
	<div class="news_box">
		<div class="news_box_title">
			<?=$page_title?> <span class="info"><span><?=number_format($start_row)?>-<?=number_format($end_row)?></span> | <span><?=number_format($total_count)?>건</span></span>
		</div>
		<?	$i=1;
		foreach ($list as $key=>$val) {

//			var_dump($list);exit();
		if($content_type == '2') {
			$title = '['.$val['column_name'].'] '.$val['title'];
		} else {
			$title = $val['title'];
		}
		$content 	= strip_tags($val['content']);

		$title_txt = mb_strimwidth($title, '0', '60', '..', 'utf-8');
		$content_txt = mb_strimwidth($content, '0', '180', '..', 'utf-8');

		foreach($arr_search_keyword as $val3) {
			$title_txt 		= str_replace($val3, '<b>'.$val3.'</b>', $title_txt);
			$content_txt	= str_replace($val3, '<b>'.$val3.'</b>', $content_txt);
		}

		$display_date_txt = gf_article_date_text($val['display_date']);

		$share_title 	= str_replace("'", "\\'", $val['title']);
		$share_title  	= str_replace('"', '\\"', $share_title);
		$share_content  = mb_strimwidth($content, '0', '200', '..', 'utf-8');
		$share_content  = htmlspecialchars($share_content);
		$share_content  = str_replace("'", "\\'", $share_content);
		$share_content  = str_replace('”', '"', $share_content);

		$main_img = $val['main_img'];
		if($content_type == '2') {
			$view_url = '/m/news/column_view/'.$val['idx'];
			$share_id_name ="column_".$val['idx'];
		} else if($content_type == '3') {
			$view_url = '/m/life/life_view/'.$val['idx'];
			$share_id_name ="life_".$val['idx'];
		}

		?>

		<div class="news_box_con">
			<input type="hidden" name="content_<?=$share_id_name?>" id="content_<?=$share_id_name?>" value="<?=$share_content?>">
			<input type="hidden" name="title_<?=$share_id_name?>" id="title_<?=$share_id_name?>" value="<?=$share_title?>">
			<input type="hidden" name="copy_url_<?=$share_id_name?>" id="copy_url_<?=$share_id_name?>" value="<?=WWW_CROSSMAP?><?=$view_url?>">
			<input type="hidden" name="img_url_l<?=$share_id_name?>" id="img_url_<?=$share_id_name?>" value="<?=WWW_CROSSMAP?><?=$main_img?>">
			<h2 class="search_tit"><a href="<?=$view_url?>"><?=$title_txt?></a><? if($content_type!='1') { ?><span class="n_date"><?=$display_date_txt?><?}?></h2>
			<div class="news_box_con_left">
				<div><?=$content_txt?></div>
				<div class="news_box_detail" style="padding-top: 35px;">

					<?if($content_type == 3):?>
						<span class="profile"><a href="/m/life/editor/<?=$val['partner_idx']?>"><div style="float:left;border-radius: 21px;cursor:pointer;width:21px;height:21px;background:url('<?=@$val['partner_img']?>') no-repeat center; background-size:cover;"></div>&nbsp;&nbsp;<?=@$val['editor_name']?></a></span>
						<span><img src="/img/web/search_bar.gif"></span>
					<?endif;?>

					<?if($content_type == 2):?>
						<span class="profile"><a href="/m/news/columnist/<?=$val['partner_idx']?>"><?=@$val['column_name']?></a></span>
						<span><img src="/img/web/search_bar.gif"></span>
					<?endif;?>


					<span><img src="/img/web/img_heart.gif"><?=number_format($val['like_count'])?></span>
					<span><img src="/img/web/search_bar.gif"></span>
					<span><img src="/img/web/img_comment.gif"><?=number_format($val['comment_count'])?></span>
				</div>
			</div>
			<div class="news_box_con_right<?=($val['video_url']) ? " plays_b" : ""; ?>">
				<a href="<?=WWW_CROSSMAP?><?=$view_url?>"><img src="<?=$val['main_img']?>"></a>
			</div>
		</div>



			<?		$i++;
		}?>




	</div>
	<div class="news_box">
		<div class="pagenumber">
			<?=$pagination?>
		</div>
	</div>




<? require_once(APPPATH."views/m/search/search_footer_inc.php"); ?>
