<?php

$ci=& get_instance();

$ci->load->library('comm');
$arr_news_comm = $ci->comm->fn_news_footer();

$arr_recomm_news        = $arr_news_comm['arr_recomm_news'];
$arr_realtime_keyword   = $arr_news_comm['arr_realtime_keyword'];



?>


    <div class="timenews">
		<div class="wrap">
			<div class="t_left">
				<h4>이 시각 추천뉴스</h4>
				<div class="photonews">
            <?
            for($i=1;$i<=2;$i++) {
                if(isset($arr_recomm_news[$i])==true) {
                    $reomm_news = $arr_recomm_news[$i];
            ?>
                    <div>
						<div style="width:230px; height:148px; background:url('<?=$reomm_news['theme_img']?>') no-repeat center; background-size:cover;"></div>
						<p class="txt"><a href="/web/news/news_view/<?=$reomm_news['content_idx']?>"><?=$reomm_news['title']?></a></p>
					</div>
            <?
                }
            }
            ?>
				</div>
				<div class="listnews">
             <?
            for($i=3;$i<=10;$i++) {
                if(isset($arr_recomm_news[$i])==true) {
                    $reomm_news = $arr_recomm_news[$i];

					$title_txt = mb_strimwidth($reomm_news['title'], '0', '65', '..', 'utf-8');


            ?>
					<p><a href="/web/news/news_view/<?=$reomm_news['content_idx']?>"><?=$title_txt?></a></p>
            <?
                }
             }
            ?>
				</div>
			</div>
			<div class="t_right">
				<div class="issue2">
					<h4>실시간 급상승<span class="fr" style="margin-top:-3px;"><a href="javascript:change_realtime_keyword_page(-1)"><img src="/img/web/img_section_left.jpg"></a><a href="javascript:change_realtime_keyword_page(1)"><img src="/img/web/img_section_right.jpg"></a></span></h4>
					<div>
			 <?
			 	$i=1;
				$realtime_keyword_count	= count($arr_realtime_keyword);
				$realtime_keyword_page 	= ceil($realtime_keyword_count/5);
               	foreach ($arr_realtime_keyword as $key=>$val) {
               		$curr_page = ceil($i/5);

                    $last_rank  = $val['last_rank'];
                    $rank       = $val['rank'];

					$display_style = 'block';
					if($i > 5)	$display_style = 'none';

                    $class = '';
                    $last_rank_txt = '';
                    if($last_rank==0){
                        $class = 'new';
                        $last_rank_txt = 'NEW';
                    } else {
                        $calc_rank = $last_rank - $rank;
                        if($calc_rank == 0){   // 같음
                            $last_rank_txt = '-';
                        } else if($calc_rank > 0){   // up
                            $last_rank_txt = '<img src="/img/web/btn_up.jpg">'.$calc_rank;
                        } else {
                            $last_rank_txt = '<img src="/img/web/btn_down.jpg">'.abs($calc_rank);
                        }
                    }

                    $keyword_text = mb_strimwidth($val['keyword'], '0', '25', '..', 'utf-8');

            ?>
						<div class="issue_box realtime_keyword_page<?=$curr_page?>" style="display:<?=$display_style?>">
							<span class="no"><?=$rank?></span>
							<span><a href="/web/search/?search_keyword=<?=urlencode($val['keyword'])?>"><?=$keyword_text?></a></span>
							<span class="bbox new updown"><?=$last_rank_txt?></span>
						</div>
            <?  	$i++;
               	}?>

					</div>
				</div>

				<div class="banner3"><a href="https://abluestore.com/product/detail.html?product_no=25&cafe_mkt=google_aw&utm_source=google&utm_medium=display&utm_campaign=curble&gclid=EAIaIQobChMIwNPeo4235wIVDGq9Ch2W_AYbEAEYASAAEgKflPD_BwE" target="_blank"><img src="/img/web/banner3_0204.jpg"></a>
<!-- PC_라이프_우측하단 
<ins class="adsbygoogle"
     style="display:inline-block;width:250px;height:250px"
     data-ad-client="ca-pub-7071495522658800"
     data-ad-slot="1272145884"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script> -->
				</div>

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


<script>
var realtime_keyword_curr_page = 1;
function change_realtime_keyword_page(page){
	var total_page = "<?=$realtime_keyword_page?>";
	var move_page = realtime_keyword_curr_page + page;
	if(move_page > 0 && total_page >= move_page) {
		$(".realtime_keyword_page"+move_page).show();
		$(".realtime_keyword_page"+realtime_keyword_curr_page).hide();
		realtime_keyword_curr_page = move_page;
	}
}
</script>
<script type="text/javascript" src="//wcs.naver.net/wcslog.js"></script>
<script type="text/javascript">
if(!wcs_add) var wcs_add = {};
wcs_add["wa"] = "2ee4bea3106352";
wcs_do();
</script>