<?
$now_date = date("Y.m.d");
?>

    <div class="contents">
		<div class="wrap">
			<div class="list_left">
				<div class="news_list">
					<div class="rankynews" style="margin-top:0 !important;">
						<div class="rankytop">
							<span class="ranky_tit">랭킹뉴스</span>
							<span class="ranky_date"><span class="btn-default_bb" style="margin-right:10px;">오늘</span> <?=$now_date?></span>
						</div>
						<ul class="rankylist">
							<li><a href="/web/news/ranking" <? if($ranking_type=='1') { echo 'class="current"'; }?>>많이본</a></li>
							<li><a href="/web/news/ranking?ranking_type=2" <? if($ranking_type=='2') { echo 'class="current"'; }?>>댓글많은 </a></li>
							<li><a href="/web/news/ranking?ranking_type=3" <? if($ranking_type=='3') { echo 'class="current"'; }?>>공감많은</a> </li>
						</ul>
					</div>

                <?

				if(count($list) == 0) {
                		echo '<div style="width: 100%; padding-left:40%">등록된 내용이 없습니다.</div>';

				} else {

					foreach ($list as $val) {

                		if($ranking_type=='1') {
                			$ranking_view_txt = '조회 '.number_format($val['hit_count']);
						} else if($ranking_type=='2') {
							$comment_count = $val['comment_count'];
							$comment_count_txt = $comment_count;
							if($comment_count > 9) {
								$calc_count = str_pad(1, strlen($comment_count), "0", STR_PAD_RIGHT);
								$comment_count_txt = (floor($comment_count/$calc_count)) * $calc_count;
								$comment_count_txt = $comment_count_txt.'+';
							}
							$ranking_view_txt = '<img src="/img/web/img_comment.png"> '.$comment_count_txt;
						} else if($ranking_type=='3') {
							$ranking_view_txt = '<img src="/img/web/img_heart.gif"> '.number_format($val['review_count1']);
						}

                        $title_txt 		= mb_strimwidth($val['title'], '0', '38', '..', 'utf-8');
						$content 		= preg_replace("(\<(/?[^\>]+)\>)", "", $val['content']);
                        $content_txt 	= mb_strimwidth(strip_tags($content), '0', '250', '..', 'utf-8');

						$display_date =  $val['display_date'];
                        $display_date_txt = substr($display_date, 0, 10);
                        $display_date_txt = str_replace('-', '.', $display_date_txt);

						$press_homepage = $val['press_homepage'];

                ?>


                    <div class="news_list_cont">
						<div class="list_no beachblue"><?=$val['rank']?></div>
						<div class="art-info">
							<h2 class="art-title">
								<a href="/web/news/news_view/<?=$val['content_idx']?>"><?=$title_txt?></a>
								<? if($arr_news_setting['etc_char1']=='Y') {?><span class="company"><a href="<?=$press_homepage?>" target="_blank"><?=$val['press_name']?></a></span><?}?>
								<span class="comment fr"> <?=$ranking_view_txt?></span>
							</h2>
							<p class="n_date"><?=$display_date_txt?></p>
							<p class="art-sum"><a href="/web/news/news_view/<?=$val['content_idx']?>"><?=$content_txt?></a> </p>
						</div>
						<div class="art-img"><a href="/web/news/news_view/<?=$val['content_idx']?>"><img src="<?=$val['main_img']?>" width="160"></a></div>
					</div>

                <?  }
				}


                ?>

				</div>
				<? if($pagination !='') {?>
				<div class="pagenumber">
					<?=$pagination?>
				</div>
			    <? }?>
			</div>


			<? include_once ('news_right_inc.php');?>
		</div>
	</div>